can someone tell me how to correct this
-
Public Sub CalcDaysWorked() Dim I, X As Integer For I = 41 To 1 Step -1 If (FrmCalendar.TxtDate(I).Text = "1") Or ((FrmCalendar.TxtDate(I).Text = "2") Or (FrmCalendar.TxtDate(I).Text = "3") Or _ (FrmCalendar.TxtDate(I).Text = "7")) Then FrmCalendar.TxtDaysWrkd.Text = (Val(X)) Exit Sub Else If FrmCalendar.TxtDate(I).Text = "W" Then X = (X + 1) Else If (FrmCalendar.TxtDate(I).Text <> "1") Or ((FrmCalendar.TxtDate(I).Text <> "2") Or _ (FrmCalendar.TxtDate(I).Text <> "3") Or (FrmCalendar.TxtDate(I).Text <> "7")) Then 'IGNORE IT I = (I - 1) End If End If End If Next I FrmCalendar.TxtDaysWrkd.Text = (Val(X)) FrmCalendar.TxtDaysWrkd.Refresh End Sub BAsically this is part of an employees attendance/work record it keeps track of points(1,2,3 or 7) days worked"w" and some misc info that need not be tracked for this calculation thus the I=I-1 'to ignore the entry I need to calculate the days worked (my w's) after the last occurance of an infraction(1,2,3 or 7) My code works 100% however i forsee an error if a "w" is enetered on the last day of the month This is because the x values is only calulating on ever other loop through the code The problem is in the above code..When I debug it it gets called on correctly everytime but the "x" value is not incrementing by 1 every time! Greg S