On Form Load Event and on Drop-Down Box BeforeUpdate Event

M

Mona-ABE

I have an unbound form where I run the procedure below on the 2 events
mentioned in the subject line of this message. When the form first opens, it
doesn't perform the second half of the calculation (labeled "PART 2 - " in
the comments). Yet it works perfectly with the drop-down BeforeUpdate event.
I've also tried the other form events such as open, activate and current;
and that part of the code still doesn't work. Any ideas why? Thanks for the
guidance!
__________________________________________

Dim intNumOfWorkDays As Integer
Dim intNumOfVacaDays As Integer
Dim intEmployeeID As Integer

intEmployeeID =
Form_frmPrjTrkProjectDataEntry.Leader_Forecasted_Days.Controls("ProjEmplID").Value

Dim K As Integer
For K = 1 To 12
'PART 1 - this code figures out how many work days--less holiday and
wkends--are in a month
intNumOfWorkDays = dhCountWorkdaysA( _
DateSerial(Year(datMyYear), K, 1), _
DateSerial(Year(datMyYear), K + 1, 0), _
Array(#1/2/2006#, #1/16/2006#, #5/29/2006#, #7/4/2006#,
#9/4/2006#, #11/23/2006#, #12/25/2006#, #1/1/2007#, #1/15/2007#, #5/28/2007#,
#7/4/2007#, #9/3/2007#, #11/22/2007#, #12/25/2007#, #1/1/2008#, #1/21/2008#,
#5/26/2008#, #7/4/2008#, #9/1/2008#, #11/27/2008#, #12/25/2008#))
Me("txtCapacity" & MonthName(K, True)) = intNumOfWorkDays

'PART 2 - this code looks up the employees vacation time in the
corresponding table and displays it
intNumOfVacaDays = Nz(DLookup("[ProjVacaDays]",
"tblPrjTrkEmployeeVacation", "[ProjVacaMonth] = #" & K & "/1/" &
Year(datMyYear) & "#" & " AND " & "[ProjEmplID] = " & intEmployeeID))
Me("txtVaca" & MonthName(K, True)) = intNumOfVacaDays

Next K
 

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