Results 1 to 5 of 5
  1. #1
    cuddihy1990 is offline Novice
    Windows XP Access 2003
    Join Date
    Jun 2014
    Posts
    2

    Access dlookup invalid use of null

    Hi, in a nutshell I have a button on a form that is used to update a table based on data entered into a multi line textbox.

    However, using this data I need to find information from a different table based on information stored in variables.

    Below is a snippet of the code used;

    Code:
    EmpName = DLookup("[Name]", "dbo_BomEmployee", "Employee =" & BUILDID)
    
    OvenName = DLookup("[Name]", "dbo_BomEmployee", "Employee =" & OVENID)
    
    Status = DLookup("[Status]", "Employees_Performance", "LotNumber =" & LOTNUMBER)
    The top 2 dlookups work, but the bottom one doesnt and returns an Invalid Use of Null error message. This shouldn't be the case because the data is in the Employee Performance table (The data in the variable 'LOTNUMBER' is in the Employee_Performance table under the LotNumber column.

    Most forums that I have checked out have said use the NZ function in front of the DLOOKUP to allow null values to return but null values should not be returning in the first place.




    Any help would be greatly appreciated...

    Bill

  2. #2
    hapm is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2014
    Posts
    197
    What is the type of your Status variable? And are you sure that there is no LOTNUMBER with a null value?

  3. #3
    lfpm062010 is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2013
    Location
    US
    Posts
    415
    Is "LotNumber" a text or number data type?

    If text then you need sigle or double quote around the "LOTNUMBER".

  4. #4
    cuddihy1990 is offline Novice
    Windows XP Access 2003
    Join Date
    Jun 2014
    Posts
    2
    lfpm062010 you beauty, cheers I have been banging my head against a brick wall for the majority of the afternoon, I didn't think that double quotes would work as I thought that it would take the word LOTNUMBER rather than what was in the variable but yes it has worked now thanks both

  5. #5
    atuhacek is offline New
    Windows 8 Access 2010 64bit
    Join Date
    Jun 2014
    Location
    Michigan
    Posts
    61
    Mark as solved

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

Similar Threads

  1. Replies: 3
    Last Post: 11-13-2013, 08:56 AM
  2. Dlookup problem - Invalid use of Null
    By chuki2 in forum Programming
    Replies: 1
    Last Post: 07-18-2012, 10:36 PM
  3. DLookUp function giving invalid use of null error
    By shubhamgandhi in forum Programming
    Replies: 4
    Last Post: 07-21-2011, 06:04 PM
  4. Invalid use of Null
    By Wayne311 in forum Programming
    Replies: 4
    Last Post: 01-27-2011, 05:10 PM
  5. Invalid Use of Null!?!
    By Kipster1203 in forum Access
    Replies: 4
    Last Post: 05-13-2010, 06:09 AM

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