Results 1 to 4 of 4
  1. #1
    crowegreg is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Posts
    398

    Dlookup problem

    Hello,


    Here is one dlookup statement that works properly:
    DLookup("FirstName", "1_Customer", "TimeCreated=#3/17/2014 3:03:11 PM#")

    This one produces the message of invalid use of null:
    DLookup("FirstName", "1_Customer", "ListID='800007BE-1403477054'")

    ListID is a text field, while TimeCreated is a date field.

    What am I doing wrong?

  2. #2
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,828
    if dlookup doesn't find a match it will return null, so I suspect it is something you are doing with the value dlookup returns which does not handle nulls

    try something like

    nz(DLookup("FirstName", "1_Customer", "ListID='800007BE-1403477054'"),"ListID not found")

  3. #3
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    I see nothing wrong in your syntax, but DLookup returns a Null if no Records fit the Criteria or if the Domain, 1_Customer, in this case, contains no Records.

    Linq ;0)>

  4. #4
    crowegreg is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Posts
    398
    Thank you. You both provided me with the solution.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. problem dlookup
    By ladiross in forum Access
    Replies: 5
    Last Post: 09-10-2015, 09:36 AM
  2. Dlookup problem
    By JeroenMioch in forum Access
    Replies: 6
    Last Post: 04-03-2015, 02:28 PM
  3. dlookup problem
    By sdel_nevo in forum Programming
    Replies: 7
    Last Post: 08-19-2014, 08:20 AM
  4. DLookup Problem
    By alsoto in forum Queries
    Replies: 5
    Last Post: 02-23-2012, 12:22 PM
  5. Dlookup problem
    By metronometro in forum Queries
    Replies: 1
    Last Post: 01-07-2012, 12:17 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums