Question for Bill Edwards please.

T

TotallyConfused

Hi I posted my question in Forms. However, my question has a form event and
a report control box question. I have been searching for some simple way to
modify the following event in my form and modifying my control box in a
report. My first example looks at automatically entering a date + 7 in the
"Notice due" field. However, they need to be business days. My second
example adds 3 days to the Daydue control box. However, it needs to be 3
business days. In my search on the Discussion Groups, I found a response
from you titled, "Calculate Next Business Day" dated 8/31/05. Can you
explain your response? This seems simple enough. Some of the responses I
received have to do with functions and adding date and holiday tables. I was
hoping to avoid that if possible as I am new to code. What I would like is
if the due date is Friday, to go to next business day for my form. For my
DateAdd in my report the same. Is this possible? Can you help? Thank you
for any help you can provide.


The following is in my subform field 1stNotice, Event Click:
Private Sub 1stNotice_Click()
Me.1stNotice= Date
Me.Noticedue = DateAdd("w", 7, [1stNotice])
End Sub

The following is in my report field date controls:

Daysent =Now
Daydue=DateAdd("w",3,Now())



THANK YOU! Works great!
 
G

George Nicholson

Here's one approach.
Weekday() returns a number 1-7 for Sunday-Saturday

Private Sub 1stNotice_Click()
Me.1stNotice= Date
Select Case Weekday(Date)
Case 6 'Friday, move to Monday next week
Me.Noticedue = DateAdd("w",10,Date)
Case 7 'Saturday, move to Monday next week
Me.Noticedue = DateAdd("w",9,Date)
Case 1 'Sunday, move to Monday next week
Me.Noticedue = DateAdd("w",8,Date)
Case Else 'All others move to next week
Me.Noticedue = DateAdd("w",7,Date)
End Select

End Sub


--
HTH,
George


TotallyConfused said:
Hi I posted my question in Forms. However, my question has a form event
and
a report control box question. I have been searching for some simple way
to
modify the following event in my form and modifying my control box in a
report. My first example looks at automatically entering a date + 7 in
the
"Notice due" field. However, they need to be business days. My second
example adds 3 days to the Daydue control box. However, it needs to be 3
business days. In my search on the Discussion Groups, I found a response
from you titled, "Calculate Next Business Day" dated 8/31/05. Can you
explain your response? This seems simple enough. Some of the responses I
received have to do with functions and adding date and holiday tables. I
was
hoping to avoid that if possible as I am new to code. What I would like
is
if the due date is Friday, to go to next business day for my form. For my
DateAdd in my report the same. Is this possible? Can you help? Thank
you
for any help you can provide.


The following is in my subform field 1stNotice, Event Click:
Private Sub 1stNotice_Click()
Me.1stNotice= Date
Me.Noticedue = DateAdd("w", 7, [1stNotice])
End Sub

The following is in my report field date controls:

Daysent =Now
Daydue=DateAdd("w",3,Now())



THANK YOU! Works great!

Bill Edwards said:
dtmNextWeekDay = IIf(Weekday(dtmEndDate) = 6, DateAdd("d", 3,
dtmEndDate),
DateAdd("d", 1, dtmEndDate))
 

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

Top