Function

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Access 2000
Two text boxes: DD and dueDate
I have a public function in a standard module that will account for
weekends. I want to enter 1/7/06 in the DD textbox, add 9 months to it, move
up to the next weekday and have 10/9/06 result in the dueDate textbox. The
function works in the Immediate Window, but how do I call it after entering
the date in the DD texbox.
I know this is a dumb question!

Here is the function:
Public Function CalcdueDate(DD As Date) As Date
Dim dueDate As Date
dueDate = DateAdd("m", 9, DD)
Select Case Weekday(dueDate)
Case 1
dueDate = dueDate + 1
Case 7
dueDate = dueDate + 2
End Select
CalcdueDate = dueDate
End Function

Thanks,
 
so after you enter your DD thing ...
you'd want to put an action in "LostFocus" or "After Update" on the DD
text box

so it's look somethin glike (untested)

Private DD_AfterUpdate()

Msgbox "Your due date is" & CalcdueDate(Me.txtDD)

EndSub

hth
 
Hi Howard, this is simple to do.

In After Upate event of the DD field enter:

Me.dueDate = YourModuleName.CalcdueDate(Me.DD)
 
Back
Top