Hello, I'm doing a form to filter a report and make a 3 combobox to filter my report
inmy case i already came up with code but after i put the 3rd combobox the filter doesn't recognize it and popup a enter parameter value
can someone help me fix this so i can use 3 combobox filter without a problem
thanks
this is my code that im using
Option Compare Database
Private Sub CLEAR1_Click()
Dim intCounter As Integer
For intCounter = 1 To 3
Me("Filter" & intCounter) = ""
Next
End Sub
Private Sub Filter1_AfterUpdate()
End Sub
Private Sub Form_Close()
DoCmd.Close acReport, "REPORT1" '
DoCmd.Restore 'Restore the window size
End Sub
Private Sub Form_Open(Cancel As Integer)
DoCmd.OpenReport "REPORT1", acViewPreview, , strSQL
DoCmd.Maximize 'Maximize the report window.
End Sub
Private Sub SET1_Click()
Dim strSQL As String, intCounter As Integer
' Build SQL String.
For intCounter = 1 To 3
If intCounter = 2 Then
strSQL = strSQL & "[" & Me("Filter" & intCounter).Tag & "] = #" & Me("Filter" & intCounter) & "# And "
Else
strSQL = strSQL & Me("Filter" & intCounter) & " And "
End If
Next
If strSQL <> "" Then
' Strip Last " And ".
strSQL = Left(strSQL, (Len(strSQL) - 5))
' Set the Filter property.
Reports![REPORT1].Filter = strSQL
Reports![REPORT1].FilterOn = True
End If
End Sub
inmy case i already came up with code but after i put the 3rd combobox the filter doesn't recognize it and popup a enter parameter value
can someone help me fix this so i can use 3 combobox filter without a problem
thanks
this is my code that im using
Option Compare Database
Private Sub CLEAR1_Click()
Dim intCounter As Integer
For intCounter = 1 To 3
Me("Filter" & intCounter) = ""
Next
End Sub
Private Sub Filter1_AfterUpdate()
End Sub
Private Sub Form_Close()
DoCmd.Close acReport, "REPORT1" '
DoCmd.Restore 'Restore the window size
End Sub
Private Sub Form_Open(Cancel As Integer)
DoCmd.OpenReport "REPORT1", acViewPreview, , strSQL
DoCmd.Maximize 'Maximize the report window.
End Sub
Private Sub SET1_Click()
Dim strSQL As String, intCounter As Integer
' Build SQL String.
For intCounter = 1 To 3
If intCounter = 2 Then
strSQL = strSQL & "[" & Me("Filter" & intCounter).Tag & "] = #" & Me("Filter" & intCounter) & "# And "
Else
strSQL = strSQL & Me("Filter" & intCounter) & " And "
End If
Next
If strSQL <> "" Then
' Strip Last " And ".
strSQL = Left(strSQL, (Len(strSQL) - 5))
' Set the Filter property.
Reports![REPORT1].Filter = strSQL
Reports![REPORT1].FilterOn = True
End If
End Sub