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

  • Thread starter Thread starter Scott Wilson
  • Start date Start date
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
 
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.
 
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.
 
-----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


.
 
Back
Top