Run Time Error 3075

G

gueser

I have a search form which can search for records (on another form) on 1 or
more fields. One of the fields (ShoeName) contains text which includes an
asterik. Cannot take the asterik out. It's oart of the name. anyway what can
I add to the code below to not get the 3075 error?

Private Sub cmdShoesSearchButton_Click()

Dim strSQL As String
Dim ctl As Control
For Each ctl In Me.Controls
If TypeOf ctl Is ComboBox Then
If Not ctl.Value = "" Then
ctl.SetFocus
strSQL = strSQL & ctl.Name & " = '" & ctl.Text & "' and "
End If
End If
Next
If Right(strSQL, 5) = " and " Then
strSQL = Left(strSQL, Len(strSQL) - 5)
End If
Debug.Print strSQL
If Not CurrentProject.AllForms("frm_SHOES").IsLoaded Then
DoCmd.OpenForm "frm_SHOES", acDesign, , , , acHidden
End If

Forms!frm_SHOES.Filter = strSQL
Forms!frm_SHOES.FilterOn = True
Me.Visible = False
Forms!frm_SHOES.Visible = True
DoCmd.OpenForm "frm_SHOES", acNormal, , , , acWindowNormal

End Sub
 

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