A
Andrew C
Hi
On my reports form I have a command button that when you click it, it loads
a reportform on the criteria in my combo boxed. I have pasted the code
below. My problem is that it loads the report but for all the records and
not just the ones matching the criteria. What am i missing, I am only
learning VB so will need a clear answer.
Private Sub Command15_Click()
Dim strReport As String 'Name of report to open.
Dim strField As String 'Name of your date field.
Dim strWhere As String 'Where condition for OpenReport.
strReport = "Items"
If Not IsNull(Me.Combo12) Then
If strWhere <> "" Then
strWhere = "(" & strWhere & ") AND (subid= """ & Me.Combo12 &
""")"
Else
Me.Combo12 = SubID
End If
End If
' Debug.Print strWhere 'For debugging purposes only.
DoCmd.OpenReport strReport, acViewPreview, strWhere
End Sub
Thanks
Andrew
On my reports form I have a command button that when you click it, it loads
a reportform on the criteria in my combo boxed. I have pasted the code
below. My problem is that it loads the report but for all the records and
not just the ones matching the criteria. What am i missing, I am only
learning VB so will need a clear answer.
Private Sub Command15_Click()
Dim strReport As String 'Name of report to open.
Dim strField As String 'Name of your date field.
Dim strWhere As String 'Where condition for OpenReport.
strReport = "Items"
If Not IsNull(Me.Combo12) Then
If strWhere <> "" Then
strWhere = "(" & strWhere & ") AND (subid= """ & Me.Combo12 &
""")"
Else
Me.Combo12 = SubID
End If
End If
' Debug.Print strWhere 'For debugging purposes only.
DoCmd.OpenReport strReport, acViewPreview, strWhere
End Sub
Thanks
Andrew