Report Input Parameters

P

pjscott

I’m using Sql 2000 and Access 2007.
I have a form that I’m trying to print the current record that’s displaying
on the form.

To keep the user from having to enter the MR Number and Date I’ve entered
the following in the Report Input Parameters:

@mrnum init=[forms]![frm_eeg_edit_new]![mrn], @eeg_date
date=[forms]![frm_eeg_edit_new]![eeg_date]

With these parameters when I press the Print Report button I receive a blank
report.

If I delete the parameters I’m asked for the MR Number and Date. When I
enter the MR Number and Date the report prints the data.

Can someone please give me an idea what parameters I need to enter to get
this report to automate?

Thanks for the help,

Paul
 
A

Al Campagna

pjscott,
Your open form record should have a unique identifying field value.
For example a ClientID.

With the form open, your query behind the report can use that form value
as a criteria against the ClientID field.
ClientID
=Forms!frmYourFormName!ClientID
That will filter the rpeort to return just the ClientID on the current
open form record.

OR
Another method is to call that value in the OpenReport. Given that
ClientID is a numeric value...
DoCmd.OpenReport "rptYourReportName", acViewPreview, , "ClientID = "
& ClientID
--
hth
Al Campagna
Microsoft Access MVP 2007-2009
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."
 
S

Steve

I just spent several days trying to figure this same thing out. Below is the
answer I found that worked perfectly for me.

-On the form, in design view, use the wizard to create a "preview report"
button.

-Go to the button's properties

-Go to "Event" tab

-In the "on click" box, delete the macro the wizard created

-click the "..." at the end of the "on click" box and select "code builder"
when the option pops up

-in the code builder input the following:

DoCmd.OpenReport "YOURREPORTNAME", acViewPreview, , "[ID] = " & Me.ID

-Replace YOURREPORTNAME with whatever the name of you report is, but keep
the quotation marks. Replace both instances ID with whatever is the primary
key for your table/query that feeds the form and report (keep the brackets on
the first instance).

Make sure that your VBA/Macros are enabled and try it out.

Hope it works for you.
 

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

Top