I have a problem that i have been whacking my head over. No matter what day of the week it is I need the date thats 2 mondays ago. For example, if today is tuesday I need the monday before previous. I am using MS access to do this.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I think you can use the Weekday() function @mwolfe02 mentioned, and combine it with the DateAdd() function. In these sample statements, I also used an IIf() function to tell DateAdd how many days to subtract from the starting date.
See Access’ online help topics for those functions.
You didn’t indicate whether you want to do this from VBA code or in a query. And you didn’t tell us where the date value comes from. So I can’t give anything more specific.
Edit: To do this in a query using the current date, try it this way:
If you’re running the query from within an Access application session, you could create a less nasty-looking query by building a VBA user-defined function to do the DateAdd computation, and then calling the udf in your query.