|
-
Sep 25th, 2012, 06:48 AM
#1
Thread Starter
Fanatic Member
Searching database not working properly
Hi guys, Im searching a database with the following code
Set rs = db.OpenRecordset("SELECT * FROM Leads WHERE `agent` = " & "'" & Form1.Text1.Text & "' AND " & _
"UCase( [Company Name]) LIKE '*" & UCase(Text1.Text) & "*' OR " & _
"UCase( [Contact Name]) LIKE '*" & UCase(Text1.Text) & "*' OR " & _
"UCase( [Phone Number]) LIKE '*" & UCase(Text1.Text) & "*' OR " & _
"UCase( [Contact Number2]) LIKE '*" & UCase(Text1.Text) & "*' OR " & _
"[Mobile] LIKE '*" & Text1.Text & "*' ")
now it displays the results in my listview correctly, how ever the part that does not work is WHERE `agent` = " & "'" & Form1.Text1.Text & "' AND
it's showing all the data that is in the database that contains what i type in text1.text
how ever i need it to only display the ones that contain text1.text where agent = form1.text1.text
any ideas?
regards
Jamie
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|