Connecting Tech Pros Worldwide Help | Site Map

Query through form with or without data specified

Jim
Guest
 
Posts: n/a
#1: Nov 13 '05
Hi all... I'm really scratching my head over this one...

I have a form that pops up that has three criteria fields on it,
BeginDate, EndDate, and UserID. I want the person filling out the form
to enter a begin and end date for the report, and either leave the
UserID field blank (to specify the report is for all users) or to input
a 4 digit ID for the specific user they want to run the report for.
Pretty easy until I get to the User ID part... I don't know how to do
it.

The Date field has the criteria:
Between [Forms]![GetDatesIP]![BeginDate] And
[Forms]![GetDatesIP]![EndDate]

What would you put in the criteria for the ID field to specify that if
the UserID field is blank, run it for all, or if it has a value in it
(say "U400"), run it for that value?

pietlinden@hotmail.com
Guest
 
Posts: n/a
#2: Nov 13 '05

re: Query through form with or without data specified


this might help
http://www.mvps.org/access/queries/qry0001.htm

Jim
Guest
 
Posts: n/a
#3: Nov 13 '05

re: Query through form with or without data specified


[Forms]![myForm]![myControl] OR [Forms]![myForm]![myControl] Is Null

Works like a charm... thanks mate.

Closed Thread