DateAddW

  • Thread starter Thread starter Newbie_Sashi
  • Start date Start date
N

Newbie_Sashi

In a form, Im trying to generate the end date by adding 2 days to "Start
time". The end date must exclude weekends. I have given the below code, but
this does not seem to be working. Please assist.

Private Sub PO__Click()
[End Date] = DateAddW([days 2], [Start time])
End Sub
Also, this event is trigger on clicking on the field "PO". Is there some way
I can generate the END DATE as soon as the record is loaded in the form.
 
In a form, Im trying to generate the end date by adding 2 days to "Start
time". The end date must exclude weekends. I have given the below code, but
this does not seem to be working. Please assist.

Private Sub PO__Click()
[End Date] = DateAddW([days 2], [Start time])
End Sub

DateAddW is NOT an Access function. My guess is that whoever gave you this
code also has the code for a function named DateAddW; if so you should
download it also, and put it into a standard module as a public function.

I would also expect (though not seeing the code I can't be sure) that the
syntax would be DateAddW("d", 2, [Start time]) instead of what you posted. The
latter would look for a field or control named [days 2] and probably fail.
Also, this event is trigger on clicking on the field "PO". Is there some way
I can generate the END DATE as soon as the record is loaded in the form.

Use the form's Current event.
 
Back
Top