access| Print | show
question:
How do you print a record that is currently displayed, continuous or a single form? The current form also has the corresponding subform, and also prints it together
I have a single number in a form, large subform has several sets of data, my report is a group of data page, how to achieve a click to print, can only print the current number of data reports?
Reply:
This question is too simple, I do not have another explanation, please go to the Northwind sample database, "Print the Invoice" button on the order form click the event code
Http://access911.net/down/eg/northwind2003.rar
Http://access911.net/down/eg/northwind97.rar
Sub Print shipping list _click ()
' This code is created by the Command Button Wizard.
On Error GoTo Err_printinvoice_click
Dim strDocName as String
strDocName = "Shipping List"
' Print the Invoice report and use the Invoice filter query to print the invoice for the current order.
DoCmd.OpenReport strDocName, acViewNormal, "Shipping slip filter"
Exit_printinvoice_click:
Exit Sub
Err_printinvoice_click:
' If the user cancels the operation, no error message is displayed.
Const conerrdocmdcancelled = 2501
If (ERR = conerrdocmdcancelled) Then
Resume Exit_printinvoice_click
Else
MsgBox Err.Description
Resume Exit_printinvoice_click
End If
End Sub
Here's DoCmd.OpenReport strDocName, acViewNormal, the invoice filter argument for the invoice filter is the name of a query that looks like this:
SELECT the shipping list. *
From the issuing manifest
WHERE ((Invoice. Order ID) =forms! order! Order ID);
Please refer to OpenReport's syntax, which is available in ACCESS help.