On Mon, 8 Aug 2005 16:20:58 -0500, jwr wrote:
Read my comments in line...
Fred --
Thanks for your quick reply. I attempted what you suggested.
I created an unbound form with 2 fields, Start Date and End Date.
When I added a command button, I was uncertain as to what to select.
I did add Me.Visible=False for the click event property. and named the form
ParamForm.
No, This is not where it goes.
** To write the code, here is what you do.
On the Command button's Click event line, write
[Event Procedure]
Then click on the little button with the 3 dots that appears on that
line.
When the code window opens, the cursor will be flashing between 2
already existing lines of code.
Between those two lines, write:
Me.Visible = False
Exit the code window. Save the changes.
I changed a query with the DoCmd statements.
I got the following error --
Cannot find macro or macro group DoCmd. It is or was not saved.
I have no idea what you are doing here.
What is the record source of your report?
1) It is probably a query.
What you are supposed to do is simply open that query in design view.
On the main database folder, click on Queries.
Then select your query and open it in Design View.
Or ...
2) It may be that the report record source is an SQL statement.
Open the report in design view. Display it's property sheet.
Click on the Data tab.
The Record source is the first property item.
If it says something like
"Select etc .....
Click on the button with the 3 dots on that line.
Then...
Or...
3) If the record source is a table, then create a new query with all
the fields you want to show in the report.
Then ...
Then.... on the Date Fields criteria line, write:
Between forms!ParamForm!StartDate AND forms!ParamForm!EndDate
What do I need to do now? Maybe I misunderstood you. I do not know how to
edit the command button if I need to change something.
When you then code the report's Open and Close events as indicated in
the other post, you use the same method as above in the command button
click event. Write [Event Procedure] on the Open line, click the 3 dot
button, write the code, and exit.
Do the same on the Close event line.
Thank you,
Joy
On Mon, 8 Aug 2005 12:07:23 -0500, jwr wrote:
I have a report date form (created when I used Access template for Order
Entry Database). This form appears as a pop-up form on my sales by
customer.
How do I use the same form to work the same way with another report?
Thanks
You can incorporate your existing date Form. Just don't forget to
change the code below to that of your existing form name and it's date
entry controls.
Create an unbound form. Add 2 Text Controls.
Name one StartDate and the 2nd EndDate.
Add a command button.
Code the button's click event:
Me.Visible = False
Name this form 'ParamForm'.
In each query that is the record source for a report, in it's Date
field's criteria line, write:
Between forms!ParamForm!StartDate AND forms!ParamForm!EndDate
Next, code the each report's Open event:
DoCmd.OpenForm "ParamForm", , , , , acDialog
Code the each report's Close event:
DoCmd.Close acForm, "ParamForm"
When ready to run the report, open the report. The form will display
and wait for the entry of the dates. Click the command button and the
report will run without need for any further parameter entries. When
the report closes, it will close the form.