H
h2fcell
Hello I’m using Access 2007
I have a form and report question. I have a form “frmAgy5_1†with a
datasheet view of a subform “sbfAgy5_1â€. Below the subform I have a Print
Preview button with an “On Click†event [Embedded Macro] with OpenReport
rptAgy5_1
I would like to open rptAgy5_1 using the “Order By†and “Filter†value of
the subform “sbfAgy5_1â€.
This will insure the report captures any filters or sorts a user has
applied to the subform.
The subform and report are both based on the same Record Source.
Should I be using an [Event Procedure] instead? If so what should the code
look like.
I’m guessing something like the below. Of course the below doesn’t work.
Private Sub cmdPrintPreview_Click()
Dim myFilter As String
Dim myOrder As String
myFilter = Forms!sbfAgy5_1.Filter
myOrder = Forms!sbfAgy5_1.OrderBy
DoCmd.OpenReport "rptAgy5_1", acViewPreview, , myFilter, acWindowNormal
End Sub
I have a form and report question. I have a form “frmAgy5_1†with a
datasheet view of a subform “sbfAgy5_1â€. Below the subform I have a Print
Preview button with an “On Click†event [Embedded Macro] with OpenReport
rptAgy5_1
I would like to open rptAgy5_1 using the “Order By†and “Filter†value of
the subform “sbfAgy5_1â€.
This will insure the report captures any filters or sorts a user has
applied to the subform.
The subform and report are both based on the same Record Source.
Should I be using an [Event Procedure] instead? If so what should the code
look like.
I’m guessing something like the below. Of course the below doesn’t work.
Private Sub cmdPrintPreview_Click()
Dim myFilter As String
Dim myOrder As String
myFilter = Forms!sbfAgy5_1.Filter
myOrder = Forms!sbfAgy5_1.OrderBy
DoCmd.OpenReport "rptAgy5_1", acViewPreview, , myFilter, acWindowNormal
End Sub