PC Review


Reply
Thread Tools Rate Thread

adding 1 day to a date

 
 
Simon
Guest
Posts: n/a
 
      30th Mar 2007
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

 
Reply With Quote
 
 
 
 
=?Utf-8?B?S2VuIFNoZXJpZGFu?=
Guest
Posts: n/a
 
      30th Mar 2007
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

"Simon" wrote:

> 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
>
>


 
Reply With Quote
 
=?Utf-8?B?S0FSTCBERVdFWQ==?=
Guest
Posts: n/a
 
      30th Mar 2007
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))
--
KARL DEWEY
Build a little - Test a little


"Simon" wrote:

> 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
>
>

 
Reply With Quote
 
raskew via AccessMonster.com
Guest
Posts: n/a
 
      30th Mar 2007
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 DEWEY wrote:
>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


--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200703/1

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Access Ver 2.0 Adding days to a date to give target date excluding weekends? michael.nilsen@sgs.com Microsoft Access Macros 1 30th Nov 2006 02:20 AM
Access Ver 2.0 Adding days to a date to give target date excluding weekends? Michael Microsoft Access Forms 2 19th Nov 2006 10:52 PM
Access Ver 2.0 Adding days to a date to give target date excluding weekends? michael.nilsen@sgs.com Microsoft Access VBA Modules 1 19th Nov 2006 01:06 PM
Changing the date format & adding the date range to the header =?Utf-8?B?UHVyZUV2aWw=?= Microsoft Access 1 6th Oct 2006 11:31 PM
Reports---adding Month-To-Date and Year-To-Date totals Patricia R. Turner Microsoft Access Reports 1 19th Sep 2003 06:23 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:10 AM.