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

Help with IF statment

7 of 9
P: 23
Hello All,

Here is my problem. I want to write code in VBA for an access DB macro that will (based on the day of the week) run 1 of 2 queries but I donít know how to go about doing it. Here is what I mean:

IF today is Monday
THEN run qry1
ELSE run qry2

How do I do this?
May 29 '08 #1
Share this Question
Share on Google+
2 Replies


jeffstl
Expert 100+
P: 432
Hello All,

Here is my problem. I want to write code in VBA for an access DB macro that will (based on the day of the week) run 1 of 2 queries but I donít know how to go about doing it. Here is what I mean:

IF today is Monday
THEN run qry1
ELSE run qry2

How do I do this?
VB has a format function for dates that returns the day of the week based on a number. I think Monday is 2.

Then you are also going to have to format the actual date returned by a date function....

So..

If (Format(Now( ), "dddd")) = "Monday" then
do query
else
do other query
end if

All kind of tutorials on this kind of formatting at:

http://www.google.com/search?hl=en&q...rmat%28Date%2C
May 29 '08 #2

7 of 9
P: 23
VB has a format function for dates that returns the day of the week based on a number. I think Monday is 2.

Then you are also going to have to format the actual date returned by a date function....

So..

If (Format(Now( ), "dddd")) = "Monday" then
do query
else
do other query
end if

All kind of tutorials on this kind of formatting at:

http://www.google.com/search?hl=en&q...rmat%28Date%2C
Thanks, and sorry for the delay.
Jun 4 '08 #3

Post your reply

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