Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

get a date that is 7 days in the future

Status
Not open for further replies.

galorin

MIS
Nov 22, 2007
154
GB
I have a portion of a query that gets a start date and end date from a form. It is used to get 4 different queries for events that have happened in the past. I need to modify the query definition so that it asks for dates in the future. I have tried explaining to a few people how it "should" work, but they don't get it, so I want to take the logic out of their hands. I would be wanting 7 days from the start date, and 7 days from the end date. How do I do this in Access?

I also don't know if my ! and . are in the right place, but they work.

in the query designer - criteria column for relevant date:
Code:
>[Forms]![FollowRep]![Range].[Form]![Start] And <[Forms]![FollowRep]![Range].[Form]![End]
 
>[Forms]![FollowRep]![Range].[Form]![Start]+7 And <[Forms]![FollowRep]![Range].[Form]![End]+7

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
I tried that, and wound up with empty resultsets, when there is valid data present. Am I missing something out that might help?
 
the ">" means "greater than".

You probably do not have these values in your recordset (yet) ... after all they lie in the FUTURE?

So, the expression -AS WRITTEN- should return the empty record set. If the full context of the expression were known it would be easier to see what you are actuall trying to do.



MichaelRed


 
Galorin, are you outside the US? In UK and Australia I normally have to format dates on forms to US format regardless of regional settings or table level formatting, so my criteria in your situation would be:

>format([Forms]![FollowRep]![Range].[Form]![Start]+7,"mm/dd/yyyy") And <format([Forms]![FollowRep]![Range].[Form]![End]+7,"mm/dd/yyyy")

Just an idea....JB
 
I live in the UK, however the dates referenced in [Forms]![FollowRep]![Range].[Form]![Start] are contained in a combobox/textbox so they probably do need formatting as suggested. Will try it and get back to you.

@MichaelRed, yes, I know they are in the FUTURE, as the events referenced will be happening in the FUTURE. :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top