Question about Combo Boxes and WHERE clauses (1 Viewer)

AccessIsEggs

New member
Local time
Today, 06:21
Joined
Jul 24, 2019
Messages
9
Hello,

I'm currently creating a database to categorize a bunch of stuff in my house, and now I'm looking into making a rudimentary search function through the various tables.

I've pinpointed my error, but I'm really quite unsure how to fix this as I'm a novice with access VBA.

I have two combo boxes that are acting as filters on some subforms, I currently have some code that looks to see if both combo boxes are being used, and then goes into changing the record source of the respective subforms.

It's catching on the WHERE clause in the recordsource, specifically this line of code

WHERE [Tools].[ToolID]=" Me.cboTooling & "" AND [Tools].[UseID]=" & Me.cboUsage & ""

I believe the error is caused with the AND statement, but I'm not sure how to use both of these as search requirements.

I appreciate your help!
 
Last edited:

bob fitz

AWF VIP
Local time
Today, 14:21
Joined
May 23, 2011
Messages
4,721
Perhaps:

WHERE [Tools].[ToolID]=" & Me.cboTooling & " AND [Tools].[UseID]=" & Me.cboUsage
 

AccessIsEggs

New member
Local time
Today, 06:21
Joined
Jul 24, 2019
Messages
9
Many thanks! This worked wonderfully.

I had a feeling that it was something specific that I just hadn't picked up since I'm self taught when it comes to access VBA.
 

Users who are viewing this thread

Top Bottom