• lookup table (Access 2000)

    Author
    Topic
    #363113

    How to look up in a table depending on an option

    I have a tables called Affiliates with the following order

    afid,CompanyName,City

    I have a form called F1.
    I have made the following code which didnt work:
    If Forms![F1]![Office] = 1 Then
    Forms![F1]![labelOffice].Caption = DLookup(“Affiliates”,”City”, afid = 1)
    End if

    Can somebody tell me where is my error?

    Viewing 0 reply threads
    Author
    Replies
    • #553317

      The table name is the middle argument, so try this:
      DLookup(“City”,”Affiliates”,afid=1)

      • #553481

        Hi,
        The third argument also needs to be a string:
        DLookup(“[City]”,”Affiliates”,”[afid] = 1″)
        Hope that helps.

    Viewing 0 reply threads
    Reply To: lookup table (Access 2000)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: