C
Céline Brien
Hi everybody,
I would like to open a report from a form.
I create a bouton, see below codes ONE.
These codes show all records in report.
I would like to view only the selected record in the sub-form.
I tried to add a filter to my codes. See below codes TWO.
I get an error on Me.NoServices.
NoServices is a field of the sub-form NOT the form.
The button is create in the form.
Access can't find the NoServices.
What do you suggest ?
Many thanks,
Céline
Codes ONE
-----------------------------------------------------------
Private Sub cmdFacture_Click()
On Error GoTo Err_cmdFacture_Click
Dim stDocName As String
stDocName = "EFacture"
DoCmd.OpenReport stDocName, acPreview
Exit_cmdFacture_Click:
Exit Sub
Err_cmdFacture_Click:
MsgBox Err.Description
Resume Exit_cmdFacture_Click
End Sub
Codes TWO
-----------------------------------------------------------
Private Sub cmdFacture_Click()
On Error GoTo Err_cmdFacture_Click
Dim stDocName As String
Dim strFiltre As String
strFiltre = "noServices= " & Me.NoServices
stDocName = "EFacture"
DoCmd.OpenReport stDocName, acPreview, , strFiltre
Exit_cmdFacture_Click:
Exit Sub
Err_cmdFacture_Click:
MsgBox Err.Description
Resume Exit_cmdFacture_Click
End Sub
I would like to open a report from a form.
I create a bouton, see below codes ONE.
These codes show all records in report.
I would like to view only the selected record in the sub-form.
I tried to add a filter to my codes. See below codes TWO.
I get an error on Me.NoServices.
NoServices is a field of the sub-form NOT the form.
The button is create in the form.
Access can't find the NoServices.
What do you suggest ?
Many thanks,
Céline
Codes ONE
-----------------------------------------------------------
Private Sub cmdFacture_Click()
On Error GoTo Err_cmdFacture_Click
Dim stDocName As String
stDocName = "EFacture"
DoCmd.OpenReport stDocName, acPreview
Exit_cmdFacture_Click:
Exit Sub
Err_cmdFacture_Click:
MsgBox Err.Description
Resume Exit_cmdFacture_Click
End Sub
Codes TWO
-----------------------------------------------------------
Private Sub cmdFacture_Click()
On Error GoTo Err_cmdFacture_Click
Dim stDocName As String
Dim strFiltre As String
strFiltre = "noServices= " & Me.NoServices
stDocName = "EFacture"
DoCmd.OpenReport stDocName, acPreview, , strFiltre
Exit_cmdFacture_Click:
Exit Sub
Err_cmdFacture_Click:
MsgBox Err.Description
Resume Exit_cmdFacture_Click
End Sub