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

If then statement in reports

P: 2
I have a simple database tracking a vacation schedule. All I have is 3 tables and so far 1 form other then the switchboard. In the main table I have leaving date and returning date fields. Basicly I want a report that only shows who is currently on vacation.


Thank You
Josh
Nov 26 '06 #1
Share this Question
Share on Google+
4 Replies


Expert 5K+
P: 8,435
I have a simple database tracking a vacation schedule. All I have is 3 tables and so far 1 form other then the switchboard. In the main table I have leaving date and returning date fields. Basicly I want a report that only shows who is currently on vacation.
That should be pretty simple. Just design your report, and for the data source give it something like the following query
Expand|Select|Wrap|Line Numbers
  1. SELECT * FROM Table1
  2.   WHERE ([Leaving] <= Date() AND [Returning] >= Date())
You might even get away with something like
Expand|Select|Wrap|Line Numbers
  1. SELECT * FROM Table1 WHERE (Date Between [Leaving] AND [Returning])
I can never remember whether you need the parentheses on the Date function, sorry.
Nov 26 '06 #2

NeoPa
Expert Mod 15k+
P: 31,186
You might even get away with something like :
Expand|Select|Wrap|Line Numbers
  1. SELECT * FROM Table1 WHERE (Date Between [Leaving] AND [Returning])
You should certainly be looking to use this format.

I can never remember whether you need the parentheses on the Date function, sorry.
Generally not. I always advise to use them, however, as it gives a visual clue to a code reader that you are referring to a function call rather than a variable or a field in your dataset.
Nov 26 '06 #3

Expert 5K+
P: 8,435
I can never remember whether you need the parentheses on the Date function, sorry.
Generally not. I always advise to use them, however, as it gives a visual clue to a code reader that you are referring to a function call rather than a variable or a field in your dataset.
Good advice - thanks.
Nov 26 '06 #4

P: 2
Thank you guys for the advice, I will give it a try!!
Dec 7 '06 #5

Post your reply

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