View Full Version : Printing Report From Form


m17347047711116
02-24-2002, 04:40 PM
I have a form upon completion of the form i would like to be able to push a button to print the Report for that form.

Problem: i have inserted the print report button but when i push it is prints out all the records in my table, i only want it to print the report for the current record on the screen any suggestions ?

PMrider
02-24-2002, 06:00 PM
Base your report on a SQL statement and in the recordID or primary key field criteria insert

=Forms![FormName]![RecordID]

the report should only show the record you have open on your form

Jack Cowley
02-24-2002, 06:14 PM
You can modify the code behind your button to read like this:

DoCmd.OpenReport "ReportName", , , "[RecordID] = & " Me![RecordID]

DocManDobie
02-25-2002, 02:42 AM
not sure if it makes a difference but as above with acnormal

DoCmd.OpenReport "your report", acViewNormal, , "[recordID] = " & Me![recordID]

Put that behind the on click and it will print the report without opening it. I presume you dont want to see the report just print it. If you want to view te report first change acviewnormal for acPreview

http://www.access-programmers.co.uk/ubb/smile.gif