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. Get our unique weekly Newsletter with tips and techniques, how to's and critical updates on Windows 7, Windows 8, Windows XP, Firefox, Internet Explorer, Google, etc. Join our 480,000 subscribers!

    Excel 2013: The Missing Manual

    + Get this BONUS — free!

    Get the most of Excel! Learn about new features, basics of creating a new spreadsheet and using the infamous Ribbon in the first chapter of Excel 2013: The Missing Manual - Subscribe and download Chapter 1 for free!

  3. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Thanked 16 Times in 16 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