Search multiple forms across multiple tables, fields and records

G

Guest

I'm creating a tracking database and have a subform within a form that I want
to create a search textbox and command button. I'm able to search off of one
field within the form but do not know how to code the search for the subform.
The two forms are as follows: frmAuditTracking, fsubPurchases. The two fields
are as follows: Forms.frmAuditTracking.txtPSR, Forms.fsubPurchases.txtReqID.

In addition, I would also like to find multiple records with the same search
criteria and not just the first record found.

Here's the code I have so far...

Private Sub cmdSearch_Click()
Dim strPSR As String
Dim strSearch As String

If IsNull(Me![txtSearch]) Or (Me![txtSearch]) = "" Then
MsgBox "Please enter a PSR/REQ.", vbOKOnly
Me![txtSearch].SetFocus
Exit Sub
End If

DoCmd.ShowAllRecords
DoCmd.GoToControl ("txtPSR")
DoCmd.FindRecord Me!txtSearch

txtPSR.SetFocus
strPSR = txtPSR.Text
txtSearch.SetFocus
strSearch = txtSearch.Text

If strPSR = strSearch Then
MsgBox "Found PSR/REQ " & strSearch & "."
txtPSR.SetFocus
txtSearch = ""

Else
MsgBox "PSR/REQ " & strSearch & " not found."
txtSearch.SetFocus
End If
End Sub

Any help would be greatly appreciated. Thanks.

James
 
G

Guest

Is this thing on? Still looking for some help. Let me know if I need to
clarify some things. Thank you in advance.
 

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