using form for entering parameters

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm using Access 02 on XP. I have developed a form for entering the
parameters for a query. I have developed a report off this query. The form
has 2 fields, an "OK" button and a "Cancel" button.

I have written macros per the directions in the Access tutorial.

When I initiate the report, the form displays. After entering the selection
criteria (parameters), I click on the "OK" button and there is nothing
happens.

Any ideas or obvious thing I have overlooked?

Thanks.
 
I'm using Access 02 on XP. I have developed a form for entering the
parameters for a query. I have developed a report off this query. The form
has 2 fields, an "OK" button and a "Cancel" button.

I have written macros per the directions in the Access tutorial.

When I initiate the report, the form displays. After entering the selection
criteria (parameters), I click on the "OK" button and there is nothing
happens.

Any ideas or obvious thing I have overlooked?

Thanks.

Very few of us use Macros for something like this and I certainly have
no idea of what the tutorial says, but if you would like to try your
hand at writing a very little bit of code, try it like this:

Create an unbound form.

Also add 2 unbound text controls.
Set their format to a valid date format (assuming it is a date
parameter you are wanting).
Name them "StartDate" and "EndDate"

Add a Command Button to the form.
Code the button's click event:
(To write code, first enter [Event Procedure] on the line that says On
Click. Then click on the little button with 3 dots that appears on
that line. The code window will open with the cursor flashing between
2 already existing lines of code. Between those 2 lines, write)

Me.Visible = False

Exit the code window.

Name this form 'ParamForm'.

As criteria in the query date field write:
Between forms!Paramform!StartDate and forms!ParamForm!EndDate

Next, code the Report's Open event:
(follow the above instructions, except it is the Report's On Open line
that you write [Event Procedure])

DoCmd.OpenForm "ParamForm", , , , , acDialog

Code the report's Close event:

DoCmd.Close acForm, "ParamForm"

When ready to run the report, open the report.
The form will open and wait for the entry of the starting and ending
dates wanted.
Click the command button and then report will run.
When the report closes, it will close the form.
 

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

Back
Top