Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Nov 2001
    Posts
    192
    Thanks
    0
    Thanked 0 Times in 0 Posts

    lookup table (Access 2000)

    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?

  2. #2
    Star Lounger
    Join Date
    Sep 2001
    Location
    SC, USA
    Posts
    60
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: lookup table (Access 2000)

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

  3. #3
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: lookup table (Access 2000)

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

    Microsoft MVP - Excel

Posting Permissions

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