Full Version: Optional Parameters in a Query
UtterAccess Discussion Forums > Microsoft® Access > Access Queries
BGAccess
I have a query that uses a form for parameters. One of the parameters is "Production Line" and is a combo box. In my criteria for the query for Production Line I have [Forms]![frmParameters]![cmbProdLine]. This works how I want it to, but now I would like to make it optional. Maybe optional isn't the best description, but basically if they do not select a Production Line it will run the query with ALL Production Lines. What is the best way to do this?

Kevin
Rainlover
Create a new field with this - [Forms]![frmParameters]![cmbProdLine]

On the Second line of the Criteria which is the Or enter Is Null
BGAccess
Thanks Des. I tried a couple of things that didn't work and couldn't figure it out. Glad it is an easy solution!

Thanks,
Kevin
Rainlover
No Problem.

You can expand this Method to have two of more parameters but it gets a bit messy after a while. That is when you should use a filter using VBA.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.