I want a blank field in User Form to pull ALL records in a Query

D

dallastony

All -
I have a user form that is used as a filter criteria for for a query.
The userform field "xMARKET" is the filter in the query, written as:
[Forms]![USERFORM_DATAPULL]![xMARKET]

This works fine. When I enter SOUP in the xMARKET, the criteria
correctly pulls only those records where the market is SOUP.

However, I want to be able to leave the field blank and have the query
pull ALL markets. I tried the following formula in the field: =IIf
(IsNull([xMARKET]),"Like '*'",[xMARKET]), but it didn't work.

Any ideas?
 
J

John Spencer (MVP)

Method one if Market ALWAYS has a value
Like Nz([Forms]![USERFORM_DATAPULL]![xMARKET],"*")

Method two if Market can be null
=[Forms]![USERFORM_DATAPULL]![xMARKET] or
[Forms]![USERFORM_DATAPULL]![xMARKET] is Null

John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top