searching

J

jason

hello all. I am having a problem with some coding. what i
have is a search form that users open. they enter any
string of text and hit the search button which i have
coded to open another form (15 fields and a subform/report)
and display any matches. so far everything works ok for
searching the 15 fields but i cannot figure out how to get
it to search the subform/subreport (which is displaying a
table).

here is the code for my search button:

Private Sub Command5_Click()
On Error GoTo Err_Command5_Click
Dim stDocName As String
Dim stLinkCriteria As String

If Len(Me.Text0 & "") = 0 Then
MsgBox "Please Enter Search Criteria.",
vbOKOnly, "Error"
Me.Text0.SetFocus

Else
stDocName = "Everything"
stLinkCriteria = "([User Info_User Name] Like ""*" &
Me.Text0 & _
"*"") OR ([User ID] Like ""*" & Me.Text0 & _
"*"") OR ([Extension] Like ""*" & Me.Text0 & _
"*"") OR ([Cubicle Number] Like ""*" & Me.Text0 & _
"*"") OR ([Location] Like ""*" & Me.Text0 & _
"*"") OR ([LAN Jack 1] Like ""*" & Me.Text0 & _
"*"") OR ([Switch Jack 1] Like ""*" & Me.Text0 & _
"*"") OR ([LAN Jack 2] Like ""*" & Me.Text0 & _
"*"") OR ([Switch Jack 2] Like ""*" & Me.Text0 & _
"*"") OR ([LAN Jack 3] Like ""*" & Me.Text0 & _
"*"") OR ([Switch Jack 3] Like ""*" & Me.Text0 & _
"*"") OR ([LAN Jack 4] Like ""*" & Me.Text0 & _
"*"") OR ([Switch Jack 4] Like ""*" & Me.Text0 & _
"*"") OR ([Phone Jack 1] Like ""*" & Me.Text0 & _
"*"") OR ([Phone Jack 2] Like ""*" & Me.Text0 & "*"")"
DoCmd.OpenForm stDocName, , , stLinkCriteria


End If
Exit Sub
Exit_Command5_Click:
Exit Sub

Err_Command5_Click:
MsgBox Err.Description
Resume Exit_Command5_Click
End Sub

this works fine.
I have tried to add another "OR ([Subform name] Like ""*"
& Me.Text0 & _"*"") and put the name of the
subform/subreport but it still does not search it.
I also tried just to put in the name of the table the
subform/subreport gets info from but that didnt work
either.
any ideas?
 

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