Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Print a report based on current record...??

Status
Not open for further replies.

WB786

MIS
Mar 14, 2002
610
I need to design a report so that, regardless of what screen you are on it prints the current record only. I have a database with multiple forms. The user switch between different forms but should be able to print from any screen. Any ideas.

Thanks,

:)WB
 
Create a Macro "print current record" and use the action "OpenReport" where the condition is similar to this...
[Name]![id]=[Forms]![Name Form]![id]

Create a form button that calls this macro.
 
Hello,
I have tried this code and I get all the records in the report not just the current record? Do you know of any way to code just for current record?

Thank you
 
Possibly a long way round but if all else fails create a query which the form is based on which only makes the selection from the record displayed in the form?
 
Well, I found this to work for now just add this in the criteria box on query for report and it will ask me for from to dates for my report this seems to work well ..

Between [Enter start date] And [Enter end date]

John
 
This is how I am doing it:

Create a query that includes a feild from the from that will be open and base your report on this query.

In the criteria of that field inside the query right click and choose build and point to all forms and then choose the field it should look for, on mine it is called recordID. Everytime you run the report and this form is open it will only take the data that is based on this recordID.

But my orginal question was how to do it in such a way that one report can be used to display a records information regardless of what form is open. I can build different reports with it's own query that point to different form recordID. But I am trying to be lazy I guess and also don't want my database to become too hugh with 10 reports that show the same info.

For right now I am going to limit this report to just one form and let the user know they will need to go to this form only if they want to run this specific report.

Hope this helps.

:)WB
 
You CAN use the same report. On your forms add a command button that opens the report in preview or prints it. In the Click event behind the button, type something like this:

DoCmd.RunCommand acCmdSaveRecord
DoCmd.OpenReport "rptYourReportName", acViewPreview, , "KeyFieldOnYourReport = " & Me!KeyFieldOnYourForm
Ann
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top