Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.
Trending News
Hopefully A Simple Microsoft Access Question-Printing A Report?
First off thanks for taking the time to look at my question. Hopefully this will be a simple answer for anyone well versed in Microsoft Access. I am designing an access database to track cell phones when customers bring them in for repair. I have created the table, form and corresponding report to print the data but when I run the report of repairs in the database the reports runs all entries in the table. I've tried to add a print button to preview the report but again it prints a mulitpage reports for all entries. Is there a way to create the print button but only have it generate a report for the entry in question. Any advice would be appriciated.
3 Answers
- 1 decade agoFavorite Answer
When you open the report, you want to filter for only the record in question using the "where" clause of the open report method.
In VB code for the print button 'On Click' event you would have the following:
Private Sub PrintButton_Click()
On Error GoTo Err_PrintButton_Click
Dim stDocName, stWhere As String
stDocName = "ReportName"
stWhere = "[ReportField]='" & Me.FormField & "'"
'(The syntax above assumes that FormField is text and not numeric)
DoCmd.OpenReport stDocName, acPreview, , stWhere
Exit_PrintButton_Click:
Exit Sub
Err_PrintButton_Click:
MsgBox Err.Description
Resume Exit_PrintButton_Click
End Sub
Regards.
- 1 decade ago
There are various approaches that can be used, the simplest is to pass a parameter to the report when opening it from the form. Take a look at the following tutorials:
Printing the Record on the Microsoft Access Form to a Report:
http://www.databasedev.co.uk/report_from_form_reco...
How To Print A Single Record from a Microsoft Access Form into a Report:
Source(s): http://www.databasedev.co.uk/ - Anonymous1 decade ago
If you go to the data properties for the report you will see a query, modify this to use an appropriate key field to show and print only the data you want.