DateAdd not working correctly. Need fast help!!

B

Ben

DateAdd("d",1-Weekday([Start_Date]),[Start_Date])

This is in my query formula. What I really need is to spit the data out
that is between Monday and Friday based on the Start_Date. So if I have 5
things going on between Monday and Friday, I want to display those 5 things
with the column header of MONDAY! Also, i need it to be in Medium Date
Format.

Please let me know the solution as soon as possible.

Thank you,
Ben
 
M

Marshall Barton

Ben said:
DateAdd("d",1-Weekday([Start_Date]),[Start_Date])

This is in my query formula. What I really need is to spit the data out
that is between Monday and Friday based on the Start_Date. So if I have 5
things going on between Monday and Friday, I want to display those 5 things
with the column header of MONDAY! Also, i need it to be in Medium Date
Format.


I'm sure that DateAdd is working as it should. What you
have will display the Sunday of the week containing
StartDate. If you want Monday to be the start of the week,
then you need to specify that:

DateAdd("d", 1 - Weekday([Start_Date], 2), [Start_Date])

Formatting is another issue. If you are displaying Monday's
date in a form/report text box or a query field, then just
set the Format property to however you want it formatted.
If for some reason (crosstab query??), you have to format
the calculated date in the calculation, then use something
like:

Format(DateAdd("d", 1 - Weekday([Start_Date], 2),
[Start_Date]), "Medium Date")
 
K

KARL DEWEY

Try this --
Format(DateAdd("d",2-Weekday([Start_Date]),[Start_Date]),"dd-mmm-yy")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top