Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / General 2 / March 2007

Tip: Looking for answers? Try searching our database.

adding 1 day to a date

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Simon - 30 Mar 2007 17:15 GMT
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
Ken Sheridan - 30 Mar 2007 17:36 GMT
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

> 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
KARL DEWEY - 30 Mar 2007 18:12 GMT
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))
Signature

KARL DEWEY
Build a little - Test a little

> 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
raskew - 30 Mar 2007 18:31 GMT
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

>Try this --
>IIf(Format([myday]+1,"w") Between 2 And
[quoted text clipped - 4 lines]
>>
>> Thanks
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.