Share via

Print Function for Microsoft access 2003

Anonymous
2011-08-22T18:28:46+00:00

I have created a database in which I created a main menu where there are three options/commands: one to open the database where it is a bunch of tables and quieries two to print that database that has all the tables and quieries, and third to close the main menu. The problem that I am having is linking the command button for the print function to the command button for the database. My main goal is when you click on the print button that it will automatically ask which experiment number you wish to print; you enter that number and it prints that tabel for that experiment. Can anyone help me?

Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Anonymous
2011-08-24T08:48:21+00:00

Hi,

What your meaning is when you click the print button, you want to print the data of specified page? If I misunderstood your meaning, Please following up here. you could use wherecondition argument on DOCmd.OpenReport, assuming I want to use a button, click on Event and add the following VBA.

Private Sub cmdPreviewRpt_Click()

Dim strReport As String

Dim strWhere As String

strReport = "My report name here"

strWhere = "[Name of my primary Key Field here] = """ & Me![Name of my Primary Key Field] & """"

DoCmd.OpenReport strReport, acViewPreview, , strWhere

End Sub

If primary key field is numeric you change strWhere sentence to:

strWhere = "[Name of KeyField] = " & Me![Name of KeyField] 

Here is a article about print a single Microsoft Access record in Form View.

http://www.techrepublic.com/article/how-do-i-print-a-single-microsoft-access-record-in-form-view/6160599

Best regards,

William Zhou


Please remember to mark the replies as answers if they help and unmark them if they provide no help.

Was this answer helpful?

0 comments No comments

0 additional answers

Sort by: Most helpful