Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2014

    Unanswered: update on open form

    I am having trouble creating a VBA that will update a calculation in a specific field when a form opens. The form is called "Test" and basically I am trying to calculate a field TAT from Due_Date - Result_Date. The calculation works great as long as the user updates within access, a fuction (WorkDays is used), the problem is since the db is linked when the Result_Date is entered there access only updates with the new value. It doesn't calculate TAT eventhough all the needed values are there. So if upon opening the form if the form was updated that may solve the problem. Thank you.

    Example, Due_Date = 10/2/2014 and Result_Date = 10/6/2014, TAT = 3 (weekends and holidays excluded by the function). Thanks .

  2. #2
    Join Date
    Apr 2014
    Provided Answers: 23
    You would just assign the text box in form open event
    txtBox = WorkDaysUsed(duedate, resultdate)

    and your function in code:
    public function WorkDaysUsed(pvDue, pvResult)
       'your code here
    end function

  3. #3
    Join Date
    Sep 2014
     Private Sub Form_Open(Cancel As Integer)
               TAT = WorkingDays(Due_Date, Result_Date)
               End Sub
    I'm not sure what you mean by function in the code. Thanks.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts