Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Multiple Queries in Access
Message
General information
Forum:
Visual Basic
Category:
Other
Miscellaneous
Thread ID:
00501255
Message ID:
00501330
Views:
14
>Hi,
>I Have my VB hooked up to Access and am trying to use multiple criteria searching one table. There is probably a simple answer I just can't find it. The code so far is:
>
>
>Dim CurrentSalary As String
>Dim EducationLevel As String
>Dim JobSector As String
>
>CurrentSalary = SearchCVresults.Combo9.Text
>EducationLevel = SearchCVresults.Combo10.Text
>JobSector = SearchCVresults.Combo11.Text
>
>Data1.RecordSource = "SELECT * FROM CV WHERE Salary = '" & CurrentSalary & "' & EducationLevel = '" & EducationLevel & "' & JobSector = '" & JobSector & "' "
>
>
>I've tried to use the FindFirst/Next/Last method aswell but that doesn't seem to be working either. PLEEASE HELP ME!

The semi-colon won't changed anything. You need to add the AND keyword (instead of the & sign) between each condition like this:
Data1.RecordSource = "SELECT * FROM CV WHERE Salary = '" & CurrentSalary & "' AND EducationLevel = '" & EducationLevel & "' AND JobSector = '" & JobSector & "' "
Éric Moreau, MCPD, Visual Developer - Visual Basic MVP
Conseiller Principal / Senior Consultant
Moer inc.
http://www.emoreau.com
Previous
Reply
Map
View

Click here to load this message in the networking platform