subform

junmart

Registered User.
Local time
Today, 09:28
Joined
Sep 14, 2001
Messages
29
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?
 
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.
 
thanks for your help. will this also print the current order in my subform? the orders subform is in continous form view.
 

Users who are viewing this thread

Back
Top Bottom