can some one pl help me urgent pl pl

M

Mike Saifie

have this data access database which I modifed.

In the Search form code I need it to modify code so, it look and match more
then one field. If the record is not in one field then it should go and look
for the second one or third. pl see the code. pl some one hlep me.

Thanks.

Mike
Option Compare Database
Option Explicit

Private Sub Clear_Click()
DoCmd.Close
DoCmd.OpenForm "Search Issues"
End Sub

Private Sub Search_Click()
Const cInvalidDateError As String = "You have entered an invalid date."
Dim strWhere As String
Dim strError As String

strWhere = "1=1"

' If Assigned To
If Not IsNull(Me.AssignedTo) Then
'Create Predicate
strWhere = strWhere & " AND " & "Issues.[Assigned To] = " &
Me.AssignedTo & ""
End If

' If Opened By
If Not IsNull(Me.OpenedBy) Then
'Add the predicate
strWhere = strWhere & " AND " & "Issues.[Opened By] = " &
Me.OpenedBy & ""
End If

' If Status
If Nz(Me.Status) <> "" Then
'Add it to the predicate - exact match
strWhere = strWhere & " AND " & "Issues.Status = '" & Me.Status &
"'"

' THIS IS WHERE I NEED A CODE SO, IT CAN SEARCH OTHER KEYS IN THE
SAME TABLE?
End If
 
G

Guest

In the code you posted, all the selected fields must match to return
anything. If all you want to do is add additional fields to the criteria,
just copy one of the If..End If statements and change the names for the field
and text box you want to add.

If, on the other hand, as you ask in your question, you want to look in a
field 2 if no match was found in field 1, that is an entirely differnt
matter. To help you adequetly, we would have to know what the code looks
like that executes the query and whether you are expecting to match on one
record or a number of records that match the criteria.
 

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