Search code problem

G

ghost

I have a form with three txt boxes that making multi search as needed and
there are 2 command buttons, one for reset all value in query and the other
one for making search and it has the following code:
'1-
If Not IsNull(txtSearchSubject) And Not IsNull(txtSearchREF) And Not
IsNull(txtSearchToFrom) Then
ElseIf Not IsNull(txtSearchREF) And Not IsNull(txtSearchToFrom) Then
Me.RecordSource = "Ref-From"
ElseIf Not IsNull(txtSearchREF) Then
Me.RecordSource = "Ref1"
End If

'2-
If Not IsNull(txtSearchSubject) And Not IsNull(txtSearchREF) And Not
IsNull(txtSearchToFrom) Then
ElseIf Not IsNull(txtSearchToFrom) And Not IsNull(txtSearchSubject) Then
Me.RecordSource = "Sub-From"
ElseIf Not IsNull(txtSearchToFrom) Then
Me.RecordSource = "From"
End If
'3-
If Not IsNull(txtSearchSubject) And Not IsNull(txtSearchREF) And Not
IsNull(txtSearchToFrom) Then
Me.RecordSource = "MultiSearch"
ElseIf Not IsNull(txtSearchSubject) And Not IsNull(txtSearchREF) Then
Me.RecordSource = "Sub-Ref"
ElseIf Not IsNull(txtSearchSubject) Then
Me.RecordSource = "Sub"
End If

The problem is, code # 1 is not working properly, just view one record and
in fact there are two values. Once I replace for example between code #3 and
#1 , code there has one value and code #1 has 2 values(working properly).
Can any body help me please?
 

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