Filter a form using a popup form

A

andrew3254

Hi, I have a form which I want to be able to filter using multiple criteria
via a pop up form. The pop up form has 5 combo boxes in order for the user
to filter using different fields. I want to do it so any of those fields can
be null and it still works.

I have the following code but it is saying it cannot find the form mentioned
in the vb code. The code is based on something I found on the microsoft
website.

Dim strSQL As String, intCounter As Integer
' Add the contents of the combo boxes to the filter string
For intCounter = 1 To 5
If Me("Combo" & intCounter) <> "" Then
strSQL = strSQL & "[" & Me("Combo" & intCounter).Tag & "] = " &
Chr(34) & Me("Combo" & intCounter) & Chr(34) & " And "
End If
Next
' Filter if strSQL is not null
If strSQL <> "" Then
strSQL = Left(strSQL, (Len(strSQL) - 5))

Forms![Frm_CV Log Sub].Filter = strSQL
Forms![Frm_CV Log Sub].FilterOn = True
End If
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top