Automatically Enter Parameter Value

M

m299600

I have several reports that run from the same set of queries. These queries
ask for a parameter value. I would like to automatically enter the parameter
value based on the report I am opening. For example, if I am opening the
John Smith report, I want the value input to be Smith. Is that possible?
 
A

Al Campagna

m299600,
I'd have to preface my remarks by saying that filtering a report
by Employee name is problematic. Using "Smith" to filter the
report, could yield several Smith records.
You should always use a unique key value to identify one record.
In this case, you should be filtering the report by something like
EmployeeID, or CustID, etc...

You can get a parameter by placing a parameter in your query, like...
Field = EmpID
Criteria = [Enter Employee ID]
OR...
If you happened to be on a certain employee's record, and call the
report from that open form, you could use a Criteria against EmpID
in the query. Example...
Field = EmpID
Criteria = Forms!frmYourFormName!EmpID.
When the report is run, the report query looks to the open
form's EmpID for it's filtering value. With no manual entry required.
--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

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

Klatuu

Just say no to report record source queries with parameters.
Provide the user with a way to select a value, then use the Where argument
of the OpenReport method.
--
Dave Hargis, Microsoft Access MVP


Al Campagna said:
m299600,
I'd have to preface my remarks by saying that filtering a report
by Employee name is problematic. Using "Smith" to filter the
report, could yield several Smith records.
You should always use a unique key value to identify one record.
In this case, you should be filtering the report by something like
EmployeeID, or CustID, etc...

You can get a parameter by placing a parameter in your query, like...
Field = EmpID
Criteria = [Enter Employee ID]
OR...
If you happened to be on a certain employee's record, and call the
report from that open form, you could use a Criteria against EmpID
in the query. Example...
Field = EmpID
Criteria = Forms!frmYourFormName!EmpID.
When the report is run, the report query looks to the open
form's EmpID for it's filtering value. With no manual entry required.
--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

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


m299600 said:
I have several reports that run from the same set of queries. These
queries
ask for a parameter value. I would like to automatically enter the
parameter
value based on the report I am opening. For example, if I am opening the
John Smith report, I want the value input to be Smith. Is that possible?
 

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