Results 1 to 4 of 4
  1. #1
    TonyB is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jul 2011
    Location
    Oxfordshire, UK
    Posts
    16

    Returning Null fields with criteria already entered in a query

    Hi,

    So I have a query running well, and I use the following Parameters (Criteria) under a field called "AdjNo" in the table called "tblReqLogs":

    Code:
    IIf(IsNull([forms]![frmDispatchReports]![Conbox]),[tblReqLogs].[AdjNo],[forms]![frmDispatchReports]![Conbox])
    Picture below to demonstrate if it's not clear:

    Attachment 18793



    What this does is tell the query to only return only records that match whatever is entered in the "Conbox" text box in the form called "frmDispatchReports". However if "Conbox" is empty, then it will return all records. Essentially, this allows users to specify the parameters of a query, using a form.

    This all works fine so long as every record has something entered for "AdjNo". Any records that do not have anything entered for "AdjNo" will not show up at all. Is there any way I can modify my statement so that it will include records that have null values in "AdjNo"?

    Hopefully this makes sense!


    Thanks

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    It should work IF you have tblReqLogs in your query.

  3. #3
    TonyB is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jul 2011
    Location
    Oxfordshire, UK
    Posts
    16
    tblReqLogs is in the query (not sure if the picture in the OP works).

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,931
    Attached image not working.

    Options:

    1. include OR IS NULL in the filter criteria

    2. calculate a field in query that converts Null to a another value with Nz() function and use that field in the criteria
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Replies: 6
    Last Post: 04-26-2012, 10:00 PM
  2. Replies: 1
    Last Post: 02-23-2012, 02:27 PM
  3. Query Not Returning Null Fields
    By mgmirvine in forum Queries
    Replies: 2
    Last Post: 10-28-2011, 06:15 PM
  4. Query not returning null values
    By janelgirl in forum Access
    Replies: 5
    Last Post: 10-11-2011, 10:31 AM
  5. Replies: 1
    Last Post: 02-25-2011, 06:11 PM

Tags for this Thread

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