Need Help in VBA Codes

F

FA

Hi Freinds,
I have a form that has the followint controls.
txtTestBeginDate----- Control Source ---> Test_Begin_Date
txtTestEndDate----- Control Source ---> Test_End_Date
cboTesterName--- Control Source---> Tester_Name_ID
txtNumberofDays---Control Source --> Unbound
checkboxTask1--- Control Source --- Task1
txtTaskBeginDate ---- Control Source ---> Task_Begin_Date
txtTaskEndDate ---- Control Source ---> Task_End_Date

Now in the after update event of txtNumberofDays i have the following
Me.Test_End_Date = NumofDays(Me.txtTestBegin_Date, Me.txtNumberofDays)
NumofDays is a function that calculates the Test_End_Date based of
Me.txtTestBegin_Date, Me.txtNumberofDays, it also take out any
satuarday and sunday or any holiday)
Now i want to do something like the following:
When the checkboxTask1 is checked, i want to prepulate the
txtTaskBeginDate, and txtTaskEndDate. Since it takes only 2 days to do
Task1, and it will be constant forever, i want determine the
txtTaskBeginDate based on txtTestBeginDate and txtNumberofDays. Task1
starts from TestBeginDate and ends in 2 working days.
Here is my function that is calculating NumofDays
Public Function NumofDays(dtStart As Date, intDays As Integer)
Dim dtEnd As Date
Dim I As Integer
I = 0
If intDays < 1 Then
Exit Function
End If
Do While I < intDays

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

If anybody has any suggestions or recommendations, please help me.

Thanks
Moe
 
F

FA

I forgot to mention one more thing,
If a Tester is selected from the combo box and he/she is already been
schedueled for a test during those dates(TestBeginDate, and
TestEndDate), then i want to prompt the user that "This tester is Busy
in these dates, Please select another Tester"VBOKONLY and then provide
a list(may be a query) of tester names available during those dates.
I dont know how do i achieve this, please somebody give me any clue or
directions.
 

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