How to open a report for a specific record in a form

G

Guest

Hello,

I have created a form that show my customers contract information and i have
created a report that shows the information as well but in the layout i want
to print.

How can i add a button on the form to open the report and show only the
record that i am currently viewing in the form? Now i dont want to have the
report auto print just open to view, is this possible?
 
J

Jeff Boyce

Add the button.

In the "Click" event, add code to open the report, something like:

DoCmd.OpenReport ... (check Access HELP for exact syntax)

Part of that syntax is how to pass a "filter" value to the report. The
filter value you want to pass is the ID of the on-screen record. You'll
have to include the ID field in the source of your report for this to work.

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
G

Guest

i checked access help and could not find the code you were talking about or
how to add it. I am very new to access i have a good understanding of how to
build tables, reports and forms but not on using codes?

Thanks
 
J

Jeff Boyce

Open a code module (or add an event procedure, say, to the Click event of
the command button in the form you're working on. Click on HELP. Search
for OpenReport.

Regards

Jeff Boyce
Microsoft Office/Access MVP
 

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