Code to disply tomorrw day

S

Simon

i need some help with some code that will display tomorrows day
for example if its 'Wednesday' it want it to display 'Thursday'
If its Friday, Saturday, Sunday i want to to display 'Monday'



If any one can help this will be great

Simon
 
M

mcescher

Simon said:
i need some help with some code that will display tomorrows day
for example if its 'Wednesday' it want it to display 'Thursday'
If its Friday, Saturday, Sunday i want to to display 'Monday'



If any one can help this will be great

Simon

format(now()+1,"dddd")

Chris
 
D

Douglas J. Steele

Display it where?

If you want it on a text box on a form, try setting the text box's
ControlSource property to

=IIf(Weekday(Date(), 2) > 4, "Monday", Format(DateAdd("d",1,Date()),"dddd"))

(complete with equal sign)
 
S

strive4peace

Hi Simon,

you can use the Weekday function to figure out how many days to add to
the date

Weekday(date, [firstdayofweek])

The Weekday function returns a whole number representing the day of the
week.

so, you could do something like this on the form OnCurrent event and the
AfterUpdate event of your date control

me.Displaycontrolname = _
Format([DateControlname]
+ IIf(Weekday([DateControlname], [vbFriday]) < 4
, 4 - Weekday([DateControlname], vbFriday)
, 1)
, "dddd")

Warm Regards,
Crystal
*
:) have an awesome day :)
*
MVP Access
Remote Programming and Training
strive4peace2006 at yahoo.com
*
 
S

strive4peace

Hi Simon,

Doug's code is better...didn't see that before I started writing ...



Warm Regards,
Crystal
*
:) have an awesome day :)
*
MVP Access
Remote Programming and Training
strive4peace2006 at yahoo.com
*


Hi Simon,

you can use the Weekday function to figure out how many days to add to
the date

Weekday(date, [firstdayofweek])

The Weekday function returns a whole number representing the day of the
week.

so, you could do something like this on the form OnCurrent event and the
AfterUpdate event of your date control

me.Displaycontrolname = _
Format([DateControlname]
+ IIf(Weekday([DateControlname], [vbFriday]) < 4
, 4 - Weekday([DateControlname], vbFriday)
, 1)
, "dddd")

Warm Regards,
Crystal
*
:) have an awesome day :)
*
MVP Access
Remote Programming and Training
strive4peace2006 at yahoo.com
*


i need some help with some code that will display tomorrows day
for example if its 'Wednesday' it want it to display 'Thursday'
If its Friday, Saturday, Sunday i want to to display 'Monday'



If any one can help this will be great

Simon
 
S

Simon

I am not doing it in a text box.

I am using VB to write an automatic email to a customer to say that a
letter will be in the post on ( Tomorrows day)
but if its a weekend or friday i want it to put monday as the day.

Thanks
 
S

strive4peace

Hi Simon,

you can still use the logic that Doug gave you for your message...

"A letter will be in the post on " _
& IIf(Weekday(Date(), 2) > 4, "Monday",
Format(DateAdd("d",1,Date()),"dddd")) _
& "."


Warm Regards,
Crystal
*
:) have an awesome day :)
*
MVP Access
Remote Programming and Training
strive4peace2006 at yahoo.com
*
 
Top