junmart
06-03-2002, 11:24 AM
I have a form with the client's info and the subform contains the orders the current client have placed. On a click of a button, i want to be able to print an order form that has the client's info i.e. address and the current order details. is there any way?
KKilfoil
06-04-2002, 04:39 AM
First, design your report as if you want to print the entire contents of the client/orders tables. Your header should contain all of the client info, and the detail section should have the order data. PREVIEW this a few times until you are satisfiled with the layout.
Now, on your MAIN form, add a command button that includes code like:
Private Sub cmdPreviewReportThisProject_Click()
On Error GoTo Err_cmdPreviewReportThisProject_Click
Dim stDocName As String
Dim strFilter As String
stDocName = "rptYourReport"
strFilter = "[ClientPKControl] = Forms!YourMainForm!txtYourClientPKControl"
DoCmd.OpenReport stDocName, acPreview, , strFilter
Exit_cmdPreviewReportThisProject_Click:
Exit Sub
Err_cmdPreviewReportThisProject_Click:
MsgBox Err.Description
Resume Exit_cmdPreviewReportThisProject_Click
End Sub
This will open a report, and filter the records to those matching a single field, whixh should be the primary key of your client table.
junmart
06-04-2002, 06:32 AM
thanks for your help. will this also print the current order in my subform? the orders subform is in continous form view.