Results 1 to 4 of 4

Thread: 2 line Validation Situation .... HELP....plz!!!!

  1. #1

    Thread Starter
    Member
    Join Date
    Sep 2000
    Location
    London, UK
    Posts
    39

    Wink 2 line Validation Situation .... HELP....plz!!!!

    Hey,

    I'm trying to set up a validation behind a text box in access and I want it to find certain values in a table. Unfortuantly I am having a problem with this piece of code a few lines long:

    I am trying to perform a procedure which checks whether a customer in a table already exists by comparing First, Last Name and Post Code. Unfortunatly I have a probelm in the FirstName variable. This is what I have tried:



    FirstName = DLookup("FName", "CustomerInfo", "[CustomerInfo]![CustID] = LCustomerID")

    Where
    LCustomerID = DLookup("CustID", "CustomerInfo", "[CustomerInfo]![LName] = Forms![Add_Customer]![txtLName]")

    But this did not work So I tried this:

    FirstName = DLookup("FName", "CustomerInfo", "[CustomerInfo]![CustID] =(DLookup("CustID", "CustomerInfo", "[CustomerInfo]![LName] = Forms![Add_Customer]![txtLName]"))")

    Still does not work

    Can anyone help me with this problem? I will be very greatful

  2. #2
    PowerPoster
    Join Date
    Jul 1999
    Posts
    5,923
    Can you stop cross-posting (in General VB and Database Dev). Also you posted the same question twice in each forum within about 15 minutes of each other. If nobody knew the first time, they aren't going to know the second time. Don't hog space, we don't need 4 posts asking the same thing.

    As for your request, this is wrong.
    Code:
    FirstName = DLookup("FName", "CustomerInfo", "[CustomerInfo]![CustID] = LCustomerID")
    It should be
    Code:
    FirstName = DLookup("FName", "CustomerInfo", "[CustomerInfo]![CustID] = " LCustomerID)
    (no quotes around numbers!!)

  3. #3

    Thread Starter
    Member
    Join Date
    Sep 2000
    Location
    London, UK
    Posts
    39
    error message: expected list or separator
    LcustomerID highlighted?????

  4. #4
    PowerPoster
    Join Date
    Jul 1999
    Posts
    5,923
    In that case try
    Code:
    FirstName = DLookup("FName", "CustomerInfo", "[CustomerInfo]![CustID] = " & LCustomerID

Posting Permissions

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



Click Here to Expand Forum to Full Width