Date Query

statistics

New member
Local time
Yesterday, 20:01
Joined
Jan 12, 2005
Messages
7
I have created two different fields, begindate and enddate in a table. I want the user to input two abstract dates and then click the command key to trigger the query. So far I have a between, and statement under criteria for both fields, one that falls into the next record. My problem is that when one of the criteria is meet then it does not matter if the other criteria is meet the results show in the query and I do not want this. If I do this without putting the criteria of the second field under the next record then fields with no value in the cell will not show in the results of the query and I also do not want this to occur. How can I solve this problem? I have coded my query as follows
Between [Forms]![Dates]![Enter Begin Date] And [Forms]![Dates]![Enter End Date:]
this statement is under both criteria for each field. What I am really looking for is an AND statement between the criteria instead of an OR statement. Is this possible?
 
I have coded my query as follows
Between [Forms]![Dates]![Enter Begin Date] And [Forms]![Dates]![Enter End Date:]
this statement is under both criteria for each field.

Open your query in SQL View.
Remove the criteria for both field and replace them with just one of both criteria.
If you want the query only to run when both parameters are seeded, add these criteria:

AND [Forms]![Dates]![Enter Begin Date] IS NOT NULL
AND [Forms]![Dates]![Enter End Date] IS NOT NULL

Add code to your command key that informs the user that the query won't be run 'cause he / she didn't enter both parameters.

RV
 

Users who are viewing this thread

Back
Top Bottom