G
Guest
I've written a procedure to calculate a date that is seven days from today that excludes weekends. I've created it as standard module that should be available to all parts of the database. However, when I call the procedure from the default value property of a text box on a form it returns either nothing or #?Name error. I've even tried creating a macro and using the RunCode function to run the script as well as placing the code within the form module and using an event procedure to call the code. I've debugged the code and it works fine. The field is a date format and the procedure should return a date that is seven days from the current date excluding weekends. I'm sure it's something obvious but I'm in the forest looking for trees aparantly. Code is as follows
Function DateCalc() As Dat
Dim dtDate As Dat
dtDate = Now() +
If Weekday(dtDate) = 7 The
dtDate = dtDate +
ElseIf Weekday(dtDate) = 1 The
dtDate = dtDate +
End I
dtDate = Format(dtDate, "mm/dd/yyyy"
DateCalc = dtDat
End Functio
Any assistance would be appreciated.
Function DateCalc() As Dat
Dim dtDate As Dat
dtDate = Now() +
If Weekday(dtDate) = 7 The
dtDate = dtDate +
ElseIf Weekday(dtDate) = 1 The
dtDate = dtDate +
End I
dtDate = Format(dtDate, "mm/dd/yyyy"
DateCalc = dtDat
End Functio
Any assistance would be appreciated.