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
Damian S - 31 Jul 2007 06:54 GMT
Hi Andrew,
You aren't setting a value for strWhere, so it is never getting into that
portion of your if/then statement.
Damian.
> Hi
>
[quoted text clipped - 29 lines]
>
> Andrew
Andrew C - 01 Aug 2007 04:10 GMT
Thnks Damian
Can you give me a bit more info on how to fix the problem so i can set the
value. I dont know much about VB and learning as i go
Thanks
Andrew
> Hi Andrew,
>
[quoted text clipped - 36 lines]
> >
> > Andrew