Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2002
    Ontario, Canada
    Thanked 0 Times in 0 Posts

    Access query (2003)

    I need to create a simple query without using VBA (I hope) that will allow me to enter a product name and, if it exists, return all matching records for that product. If the product does not exist, then I need to see all records in the table. I have set up a parameter query to allow me to enter the product name, but if I enter blank for the product name, I get no records returned. How can I set this up to get what I need? Is there a simple edit to the SQL code that is generated? I'd be willing to do that.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Thanked 31 Times in 31 Posts

    Re: Access query (2003)

    I assume that your query has a ProductName column, and something like [Enter Product] in the criteria line for that column. Change this to

    [Enter Product] Or [Enter Product] Is Null

    Take care that the parameter is exactly the same both times. The "[Enter Product] Is Null" part lets the query return all records if the parameter is left blank.

    Note: if you save the query and reopen it, you will notice that Access has rearranged the criteria; this is normal behavior; the query will still work the same way.

Posting Permissions

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