Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2002
    Posts
    1

    Exclamation Unanswered: looking up values from two different tables

    TABLE1:
    CODE WORK
    1 JACK OR JILL
    2 JACK OR JILL
    3 JACK OR JILL
    TABLE2:
    CODE WORK
    4 SUZY OR MARY
    5 SUZY OR MARY
    6 SUZY OR MARY
    now in my FORM1, the user needs to enter a CODE. I need the CODE to lookup the values from TABLE1 and TABLE2. If the user has entered a CODE value from TABLE1, the WORK will then lookup values from another table that would be either JACK or JILL. If the user has enetered a CODE value from TABLE2, the WORK will then lookup values from another table that would be either SUZY or MARY.

    HOW DO YOU DO THIS???? PLEASE help me!!! :-(

  2. #2
    Join Date
    Oct 2001
    Location
    Bay Area, CA
    Posts
    117
    Function GetWork()
    On Error Resume Next
    Dim code As Integer
    Dim JackJill As String
    Dim SuzyMary As String

    code = InputBox("enter code")
    'see if the code is in table1
    JackJill = DLookup("work", "table1", "[code] = " & code)
    If Len(JackJill) > 0 Then
    'now go to your Jack/Jill table
    End If

    If JackJill = "" Then
    'see if the code is in table2
    SuzyMary = DLookup("work", "table2", "[code] = " & code)
    If Len(SuzyMary) > 0 Then
    'now go to your Suzy/Mary table
    End If
    End If
    End Function

Posting Permissions

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