Converting and Calculating Dates on a Form

F

FA

Hi Freinds,


I have a TextBox- txtNumDays which is associated with TestStartDate and

TestEndDate. If you put Number of Days and TestStartDate, it calculates

the TestEndDate. I also have VacationBeginDate and VacationEndDate on a

different form and different table, I want the txtNumDays to calculate
the TestEndDate by Subtracting the number of days between
VacationBeginDate and
VacationEndDate. The number of days between VacationBeginDate and
VacationEndDate is provided by the users on TesterVacationForm.


I am using the following module to calculate the TestEndDate:
Public Function MyAdd(dtStart As Date, intDays As Integer) As Date


Dim dtEnd As Date
Dim I As Integer
Dim dtMiddle As Integer

Dim frmTesterVacation As Form_frmTesterVacation
Dim frmSystem As Form_frmSystem
Dim dbo_TESTERNME As TableDef
Dim NUMOFDAYS As Field



I = 0
dtEnd = dtStart

If intDays < 1 Then
Exit Function
End If


Do While I < intDays
If Nz(Form_frmSystem.TESTER_NME_ID) <> "" Then

dtMiddle = [Form_frmTesterVacation].NumberofDays

If dtMiddle = -1 Then
Exit Do
End If
End If

dtEnd = dtEnd + dtMiddle + 1

Select Case Weekday(dtEnd)
Case 2 To 6
' regular week day.MON - Fri..count one day
I = I + 1
End Select
Loop


MyAdd = dtEnd


End Function



If possible please solve this issue, i would really really appreciate
it.
 

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