Results 1 to 3 of 3
  1. #1
    3 Star Lounger
    Join Date
    Jul 2001
    Posts
    280
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Public function (Access 2000)

    I have a very nice function that i received from Hans,(Post 523463) with an excellent function.I use it as Access private function, but for some reasons i want to make my function

    public and i get always mistaked saying that the filed branch cannot be found.Could you help me rearrange the function to be public ?



    Private Function lop() , placed in the subform FOrder details extended
    Dim OfficeBranch As Control
    Dim OfficeItems As Control
    Set OfficeBranch = Me.Controls("Branch" & (Me.Parent.office - 1))
    Set OfficeItems = Me.Controls("Items" & (Me.Parent.office - 1))
    If Me!size > 18 Then
    OfficeBranch = OfficeItems
    Else
    OfficeBranch = OfficeItems / Me!pack
    End If
    Parent!current.Requery
    End Function




    Public Function lop()

    Dim MyForm As Form
    Dim MySubform As Form


    Set MyForm = Forms!FOrderInformation
    Set MySubform = [Forms]![FOrderInformation]![Forder details extended].[Form]
    Dim OfficeBranch As Control
    Dim OfficeItems As Control
    Set OfficeBranch = MyForm.Controls("Branch" & (MyForm.office - 1))
    Set OfficeItems = MyForm.Controls("Items" & (MyForm.Parent.office - 1))
    If MySubform!size > 18 Then
    OfficeBranch = OfficeItems
    Else
    OfficeBranch = OfficeItems / MySubform!pack
    End If
    MyForm!current.Requery

    End Function

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Public function (Access 2000)

    I don't see any advantage in placing this code in a standard module. You would do that if the code is general, and can be applied in various situations, but this code is highly specific, it will only work with FOrder details.

  3. #3
    3 Star Lounger
    Join Date
    Jul 2001
    Posts
    280
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Public function (Access 2000)

    The problem is that wth the subform i get conflicts with other conditions in the subform,and when i get the last item out of the list of products, the product name is blank.I do not get this error is i do not use the function.
    I have tried it everywhere in the subform, but the results were negaive.You think it will work only withthe subform,and i see you are right, i would better give up the idea.Thank you for your advice

    regards

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •