Need a way to pass a field value to a parameter query

S

Scott Wilson

I need to print a report for just the record I'm looking
at. How would I best pass the value of a field on the
current record to a query to a report. Really just
passing the value is the show stopper for me. Any help
would be greatly appreciated.

Scott in Charlotte, NC
 
A

Albert D. Kallal

Get the report working the way you want (no parameters needed in the query).

Then, the code behind your button on your form to launch the report with the
ONE current record can be:

me.Refresh
docmd.OpenReprot "your report",acViewPreview,,"id = " & me.Id

The above assumes your key id is "id"...and if it is different, then change
the above.
 
M

Marshall Barton

Scott said:
I need to print a report for just the record I'm looking
at. How would I best pass the value of a field on the
current record to a query to a report. Really just
passing the value is the show stopper for me. Any help
would be greatly appreciated.

Use the WhereCondition argument on the DoCmd.OpenReport line
of code.
 
M

Me Again

-----Original Message-----
Get the report working the way you want (no parameters needed in the query).

Then, the code behind your button on your form to launch the report with the
ONE current record can be:

me.Refresh
docmd.OpenReprot "your report",acViewPreview,,"id = " & me.Id

The above assumes your key id is "id"...and if it is different, then change
the above.


--
Albert D. Kallal (MVP)
Edmonton, Alberta Canada
(e-mail address removed)
http://www.attcanada.net/~kallal.msn


.
 

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