Results 1 to 5 of 5

Thread: AND in dlookup

  1. #1
    Join Date
    Jun 2004
    Posts
    43

    Lightbulb Unanswered: AND in dlookup

    txtbalance = DLookup("balance", "jointable", "customerid = " & cmbcustomerid & and "accounttype=" & cmbaccounttype & "")

    the and doesn't work... anyone knows what code i should put?

  2. #2
    Join Date
    Dec 2003
    Location
    WA, USA
    Posts
    51
    You need to have the 'And' inside your quotes:

    txtbalance = DLookup("balance", "jointable", "customerid = " & cmbcustomerid & "AND accounttype=" & cmbaccounttype & "")
    Bob

  3. #3
    Join Date
    Jun 2004
    Posts
    43
    there is an error

    txtbalance = DLookup("balance", "jointable", "customerid = " & cmbcustomerid & "AND accounttype=" & cmbaccounttype & "")
    syntax error (missing operator ) in query expression 'customerid=1004AND accounttype='.


    help pls.

  4. #4
    Join Date
    Dec 2003
    Location
    WA, USA
    Posts
    51
    My bad, there should be a space before the AND
    >> ...& " AND .....
    >> instead of ...& "AND .....

    The other thing to take into consideration would be your data type.
    >> If your using number format your fine.
    >> If your using text then it needs to be wrapped in single quotes.
    >>>>..."customerid = '" & cmbcustomerid & "' AND accounttype= '" & cmbaccounttype & "'")
    Bob

  5. #5
    Join Date
    Jun 2004
    Posts
    43
    the AND without space is ok my error is the datatype
    thnx for the help..

Posting Permissions

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