Printing Report Via Form (one record only please!)

J

Jack Higgs

I've got a control on my Form for the bookings that prints the invoice
reports I've produced. The report has a different page for each record. How
do I program it to just print off the one record, corresponding to the
current form data. VbCode would be nice.

Jack
 
A

Albert D. Kallal

Just restrict the report using the "where" clause.

me.Refresh ' force a disk write
docmd.OpenReport "yourReport",acViewPreview,,"id = " * me.id
 
J

Jack Higgs

Albert D. Kallal said:
Just restrict the report using the "where" clause.

me.Refresh ' force a disk write
docmd.OpenReport "yourReport",acViewPreview,,"id = " * me.id

Thanks for your reply, I've got that far, but I don't quite understand what
I'm ment to put in the "id = " * me.id bit.

Cheers,

Jack
 
C

Cheryl Fischer

Jack,

I'm sure Albert meant to type an & instead of an *. Try it that way and
you will have a WHERE clause without the WHERE, the presumption being that
you have a field/control on your form which uniquely identifies the record
(me.id) which will match to the "id" field on your report. You would need
to change "id" in your use of this code to reflect your field name.
 
J

Jack Higgs

Cheryl Fischer said:
Jack,

I'm sure Albert meant to type an & instead of an *. Try it that way and
you will have a WHERE clause without the WHERE, the presumption being that
you have a field/control on your form which uniquely identifies the record
(me.id) which will match to the "id" field on your report. You would need
to change "id" in your use of this code to reflect your field name.

Brilliant! All working now, thank you for your help, I appreciate it a lot.

Cheers,

Jack
 

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