By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,300 Members | 1,795 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,300 IT Pros & Developers. It's quick & easy.

Combine an "AND" and "OR" satement in vba query.

P: 52
I have a a statement as follows:
Expand|Select|Wrap|Line Numbers
  1. sSQL = "SELECT * FROM QueryCases WHERE Weekday(QueryCases.StartDate) = 1 OR Weekday(QueryCases.StartDate) = 7 ORDER BY QueryCases.StartDate;"
I would like to add an "AND" criteria of "WHERE QueryCases.Completed = False"

How do i combine the two?
Dec 13 '07 #1
Share this Question
Share on Google+
3 Replies


100+
P: 365
Expand|Select|Wrap|Line Numbers
  1. sSQL = "SELECT * FROM QueryCases WHERE Weekday(QueryCases.StartDate) = 1 OR Weekday(QueryCases.StartDate) = 7 AND QueryCases.Completed = False ORDER BY QueryCases.StartDate;"
jst a guess
Dec 13 '07 #2

ADezii
Expert 5K+
P: 8,638
I have a a statement as follows:

sSQL = "SELECT * FROM QueryCases WHERE Weekday(QueryCases.StartDate) = 1 OR Weekday(QueryCases.StartDate) = 7 ORDER BY QueryCases.StartDate;"

I would like to add an "AND" criteria of "WHERE QueryCases.Completed = False"

How do i combine the two?
Expand|Select|Wrap|Line Numbers
  1. sSQL = "SELECT * FROM QueryCases WHERE 
  2. Weekday(QueryCases.StartDate) In ("1","7") AND QueryCases.Completed = False ORDER BY QueryCases.StartDate;"
Dec 14 '07 #3

P: 52
Worked like a charm. Thanks
Dec 14 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.