J
jason
hello all, i have a question that is probly pretty easy
but i am not a really good coder so im lost.
i have a search form where i type in a string of text and
hit the search button. the search button is coded to open
another form that holds all my data and display matches
after looking through every text box. Lately i have added
a subform to the form that holds all my data and i cannot
figure out how to add to my search button code to tell it
to search the subform as well. here is the code to 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 "Sorry try Again.", vbOKOnly, "Error"
Me.Text0.SetFocus
Else
stDocName = "SWDATA"
stLinkCriteria = "([SITE] Like ""*" & Me.Text0 & _
"*"") OR ([NUM] Like ""*" & Me.Text0 & _
"*"") OR ([SYSTEM] Like ""*" & Me.Text0 & _
"*"") OR ([NAME] Like ""*" & Me.Text0 & _
"*"") OR ([VER] Like ""*" & Me.Text0 & _
"*"") OR ([QUANTITY] Like ""*" & Me.Text0 & _
"*"") OR ([SN] Like ""*" & Me.Text0 & _
"*"") OR ([MGR] Like ""*" & Me.Text0 & _
"*"") OR ([DEPT] Like ""*" & Me.Text0 & _
"*"") OR ([STN] Like ""*" & Me.Text0 & _
"*"") OR ([DATE REC'D] Like ""*" & Me.Text0 & _
"*"") OR ([USER] Like ""*" & Me.Text0 & _
"*"") OR ([UPDATE/NEW] Like ""*" & Me.Text0 & _
"*"") OR ([STATUS] Like ""*" & Me.Text0 & _
"*"") OR ([PURCHASE #] Like ""*" & Me.Text0 & _
"*"") OR ([VENDOR] Like ""*" & Me.Text0 & _
"*"") OR ([SERVER] Like ""*" & Me.Text0 & _
"*"") OR ([COMMENTS] Like ""*" & Me.Text0 & "*"")"
DoCmd.OpenForm stDocName, , , stLinkCriteria
End If
Me.Text0.SetFocus
Exit Sub
Exit_Command5_Click:
Exit Sub
Err_Command5_Click:
MsgBox Err.Description
Resume Exit_Command5_Click
End Sub
What i need to know is how to add code to make it search a
subform on the same form.
can anyone help?
but i am not a really good coder so im lost.
i have a search form where i type in a string of text and
hit the search button. the search button is coded to open
another form that holds all my data and display matches
after looking through every text box. Lately i have added
a subform to the form that holds all my data and i cannot
figure out how to add to my search button code to tell it
to search the subform as well. here is the code to 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 "Sorry try Again.", vbOKOnly, "Error"
Me.Text0.SetFocus
Else
stDocName = "SWDATA"
stLinkCriteria = "([SITE] Like ""*" & Me.Text0 & _
"*"") OR ([NUM] Like ""*" & Me.Text0 & _
"*"") OR ([SYSTEM] Like ""*" & Me.Text0 & _
"*"") OR ([NAME] Like ""*" & Me.Text0 & _
"*"") OR ([VER] Like ""*" & Me.Text0 & _
"*"") OR ([QUANTITY] Like ""*" & Me.Text0 & _
"*"") OR ([SN] Like ""*" & Me.Text0 & _
"*"") OR ([MGR] Like ""*" & Me.Text0 & _
"*"") OR ([DEPT] Like ""*" & Me.Text0 & _
"*"") OR ([STN] Like ""*" & Me.Text0 & _
"*"") OR ([DATE REC'D] Like ""*" & Me.Text0 & _
"*"") OR ([USER] Like ""*" & Me.Text0 & _
"*"") OR ([UPDATE/NEW] Like ""*" & Me.Text0 & _
"*"") OR ([STATUS] Like ""*" & Me.Text0 & _
"*"") OR ([PURCHASE #] Like ""*" & Me.Text0 & _
"*"") OR ([VENDOR] Like ""*" & Me.Text0 & _
"*"") OR ([SERVER] Like ""*" & Me.Text0 & _
"*"") OR ([COMMENTS] Like ""*" & Me.Text0 & "*"")"
DoCmd.OpenForm stDocName, , , stLinkCriteria
End If
Me.Text0.SetFocus
Exit Sub
Exit_Command5_Click:
Exit Sub
Err_Command5_Click:
MsgBox Err.Description
Resume Exit_Command5_Click
End Sub
What i need to know is how to add code to make it search a
subform on the same form.
can anyone help?