Code to disply tomorrw day

  • Thread starter Thread starter Simon
  • Start date Start date
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
 
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
 
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)
 
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
*
 
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
 
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
 
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
*
 

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

Back
Top