WackyWaterGuy
Registered User.
- Local time
- Today, 05:36
- Joined
- May 29, 2003
- Messages
- 25
Hi Everyone! I have been having a problem, and for the life of me, can't figure this out. Maybe one of you smart people can help me out. I am writing a dynamic query in SQL, based on checkboxes. I am having no problem linking the checkboxes back etc...but I am having problems creating the query..to an extent anyways. Here is my problem:
As an example:
MySearch = ([Shift] = A 'or' [Shift] = B)
Section = ([Location] = Kitchen)
My code that puts these together is as follows:
Then "section" is queried further down in the code!
So here is the problem: When the query is created (which I can view in design mode), it actual does this:
([Shift] =A) OR (([Shift] = B AND [Location]= Kitchen)
This is not what I want
I would like: ((([Shift] =A) OR ([Shift] = B)) AND [Location]=Kitchen)
Can someone please help!
I have tried numerous iterations putting brackets in many different place..with no luck! Can someone please help!
I would really appreciate it!
Thank you!
As an example:
MySearch = ([Shift] = A 'or' [Shift] = B)
Section = ([Location] = Kitchen)
My code that puts these together is as follows:
Code:
section = ((MySearch) & " AND" & Section)
Then "section" is queried further down in the code!
So here is the problem: When the query is created (which I can view in design mode), it actual does this:
([Shift] =A) OR (([Shift] = B AND [Location]= Kitchen)
This is not what I want
I would like: ((([Shift] =A) OR ([Shift] = B)) AND [Location]=Kitchen)
Can someone please help!
I have tried numerous iterations putting brackets in many different place..with no luck! Can someone please help!
I would really appreciate it!
Thank you!
Last edited: