G
Guest
I have a search form which currenlty searchs one table and opens a recordset
to another form for editing etc. This works great!
I now need to modify this search function to also search 2 other tables. I
am having trouble getting this to work.
I've included the original code I used for the 1st described search. The
ASONumber is the primary key in my tblJobs, the other 2 tables (tblCOMPO &
tblCustomerPO) also include this same ASONumber.Can anyone help me with the
code to modify this to satisfy the 2nd described search function?
Thanks in Advance
Private Sub Search_Click()
On Error GoTo Err_Search_Click
Dim strDocName As String
Dim strCriteria As String
Dim varWhere As Variant
strDocName = "frmJobEntry"
' If specified a ASO # value
If Not IsNothing(Me.ASONumber) Then
strCriteria = "[ASONumber]=" & Me.[ASONumber]
End If
' Do Job Name next
If Not IsNothing(Me.JobName) Then
strCriteria = "[JobName] Like'" & Me.[JobName] & "*'"
End If
' Do Quote # next
If Not IsNothing(Me.QuoteNumber) Then
strCriteria = "[QuoteNumber]= """ & Me.[QuoteNumber] & """"
End If
DoCmd.OpenForm strDocName, acNormal, , strCriteria
' and close this form
DoCmd.Close acForm, Me.Name
Exit_Search_Click:
Exit Sub
Err_Search_Click:
MsgBox Err.Description
Resume Exit_Search_Click
End Sub
to another form for editing etc. This works great!
I now need to modify this search function to also search 2 other tables. I
am having trouble getting this to work.
I've included the original code I used for the 1st described search. The
ASONumber is the primary key in my tblJobs, the other 2 tables (tblCOMPO &
tblCustomerPO) also include this same ASONumber.Can anyone help me with the
code to modify this to satisfy the 2nd described search function?
Thanks in Advance
Private Sub Search_Click()
On Error GoTo Err_Search_Click
Dim strDocName As String
Dim strCriteria As String
Dim varWhere As Variant
strDocName = "frmJobEntry"
' If specified a ASO # value
If Not IsNothing(Me.ASONumber) Then
strCriteria = "[ASONumber]=" & Me.[ASONumber]
End If
' Do Job Name next
If Not IsNothing(Me.JobName) Then
strCriteria = "[JobName] Like'" & Me.[JobName] & "*'"
End If
' Do Quote # next
If Not IsNothing(Me.QuoteNumber) Then
strCriteria = "[QuoteNumber]= """ & Me.[QuoteNumber] & """"
End If
DoCmd.OpenForm strDocName, acNormal, , strCriteria
' and close this form
DoCmd.Close acForm, Me.Name
Exit_Search_Click:
Exit Sub
Err_Search_Click:
MsgBox Err.Description
Resume Exit_Search_Click
End Sub