|
HI All,
I m trying to write an SQL query in VBA to a sql string. It will be used for a search form. I want the query to evaluate multiple text boxes filled in by the user. For example, they are fields like street name, street type, house number.
If the user inputs say Street name and Street type , 'abc st', the query should evaluate both the fields entered by the user and search for it and provide results which correspond to the entered fields , eg: should return the output as 'abc st', but i ve the written the query which would give me all the occurences for abc and the st and not the combination of it.
Following is my query:
strSQL = "SELECT E.* " & _
"FROM E " & _
"WHERE E.M='" & Me.txtmirn.Value & "' " & _
"OR E.Site='" & Me.txtcity.Value & "' " & _
"OR E.Ga='" & Me.txtgas.Value & "' " & _
"OR E.Site='" & Me.txtdpi.Value & "' " & _
"ORDER BY E.M;"
I would appreciate if anyone can tell mewhere i m going wrong?
Cheers
Aj
|