Print one record only?

pedroghuk

Registered User.
Local time
Today, 13:13
Joined
Jan 18, 2012
Messages
17
Good afternoon all

Looking at sites around the web and in particular this Forum, my problem is not uncommon but there does not appear to be a simple, easy to implement solution.

Quite simply, I want a Form to include a button, that when selected will only print the current Record and not all records in the table.

Do I need to update some Event in the Form Properties or is there a piece of code which I could apply which will meet my requirements?

The button wizards available for printing seem incorrect.

All help greatly appreciated.

Regards.
 
You can simply reference the primary key field in the form in the report query as a parameter?
 
Something like this will work.

Use the OpenReport's Where condition to specify your record. For example, the following code placed behind a command button on the form would use the RunID control on the form to restrict the Report to only one record.

Dim strDocName As String
Dim strWhere As String
strDocName = "rptSomeReport"
strWhere = "[RunID]=" & me!RunID
DoCmd.OpenReport strDocName, acPreview, , strWhere

Catalina
 
I used this code in a command buttons "OnClick" event:

Private Sub cmdPrintForm_Click()
DoCmd.OpenForm "frmrptCurrentRecordInvoice", acPreview, , "[InvoiceID]= forms!frmInvoicing![InvoiceID]"
DoCmd.PrintOut
DoCmd.Close
End Sub

All it does is open a form that I created to have the appearance of a report, prints it, then closes.
 

Users who are viewing this thread

Back
Top Bottom