adding 1 day to a date

  • Thread starter Thread starter Simon
  • Start date Start date
S

Simon

I would like to be able to display a date which will be one day more
than what i type in, but if the date i type in is a friday i would
like it to display Mondays date

Thanks
 
I assume you'd also want a weekend date to step forward to the following
Monday. Add the following function to a standard module:

Public Function NextWorkday(dtmDate As Date)

Dim dtmNextDay As Date

dtmNextDay = dtmDate + 1

Do While Weekday(dtmNextDay, vbMonday) > 5
dtmNextDay = dtmNextDay + 1
Loop

NextWorkday = dtmNextDay

End Function

In the AfterUpdate event procedure of the control put:

Dim ctrl As ctrl

Set ctrl = Me.ActiveControl
ctrl = NexWorkday(ctrl)

Ken Sheridan
Stafford, England
 
Try this --
IIf(Format([myday]+1,"w") Between 2 And
6,[myday]+1,IIf(Format([myday]+2,"w") Between 2 And 6,[myday]+2,[myday]+3))
 
Hi -

From the debug (immediate) window:
pdte = date() '3/30/07
nwd = pdte + IIf(WeekDay(pdte) > 5, 9 - WeekDay(pdte), 1)
? nwd
4/2/07

KARL said:
Try this --
IIf(Format([myday]+1,"w") Between 2 And
6,[myday]+1,IIf(Format([myday]+2,"w") Between 2 And 6,[myday]+2,[myday]+3))
I would like to be able to display a date which will be one day more
than what i type in, but if the date i type in is a friday i would
like it to display Mondays date

Thanks
 

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