Results 1 to 4 of 4
  1. #1
    poianaladra is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2015
    Location
    Philippines
    Posts
    2

    Need help with query

    Basically, i have a table with about 20 fields: i want to filter the results according to the data inserted in a form,


    but when the user compiles the form, he might not know some data, so some fields are empty, some aren't:

    what i need is a query that shows results based only on the fields that aren't empty,

    simplified example of the form that i will use to filter the results:
    First name Last name Date of birth Place of birth
    Pippo 18/12/1993 Ovodda

    Now i'd need the query to show all the records matching the three fields that have been compiled PLUS any record which field has been left empty: so, in this case, show me any record which contains Pippo in the first name field, 18/12/1993 in the DOB, Ovodda in the POB AND anything (included nothing) in the last name.
    How can i do that?
    Thanks in advance.

  2. #2
    CJ_London is offline VIP
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,445
    you need something like this

    Code:
    SELECT *
    FROM myTable
    WHERE [Last Name] is null or [Last Name]=forms!myform!lastnamectrl

  3. #3
    poianaladra is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2015
    Location
    Philippines
    Posts
    2
    Thanks for your reply!
    That would be the VB script if i'm correct; i'd like to know what to put here, though
    Click image for larger version. 

Name:	acc2.jpg 
Views:	8 
Size:	13.8 KB 
ID:	20994
    And thanks again!

  4. #4
    CJ_London is offline VIP
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,445
    is null or forms!myform!lastnamectrl

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

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