report baed on date range

aymanmb

Registered User.
Local time
Today, 21:47
Joined
Jan 28, 2007
Messages
96
Hi,

I know I know that this question was asked too many times. I serached the forum but none of the threads showed me how to solve my issue.

I craeted a simple form named "DateInput" with 2 unbound text controls for the user to inout a date range of the report. I added a command button that will make the user preview the report.

I then added to the report query the required SQL statements based as follows:
Between [Forms]![DateInput]![txtBeginingDate] And [Forms]![DateInput]![txtEndingDate]

Problem is when I run the report it does not pop up the "DateInput" form but ask the paremeters of the date range.

Is ther a missing code that will make the report open the "DateInput" form and get the date range from it and open the report with the right date range.

Reason I want to do it through a form is that I want the user to use a calender control to input the date range.

thanks for the help
 
I've never referred directly to controls on a form as criteria for a query before, but one thing I see is that you should be using [Forms]![DateInput].[txtBeginingDate] to refer to a control on the form (notice the second exlamation point is replaced by a period).

If you can't get that method to work, you can always use my preferred method which is to use functions and variables. I explained it a bit here: http://www.access-programmers.co.uk/forums/showthread.php?t=122109 already. Hope this helps.
 
Your method with the form is fine, but the report will not automatically open it (though you could code it to). Typically when the user wants to run the report, your code opens that form, not the report. Then the button on that form opens the report after the user has input the criteria.
 

Users who are viewing this thread

Back
Top Bottom