B
Bob Vance
My controls should ve Visible for 180 days but after excatly 30 days they
are greyed out
bModify = True
Dim dDate As Date
Dim dtDiff
Dim nCountDaysOfYear As Long
Dim nLeapYearNow As Long, nLeapYearOfBillYear As Long
Dim nTotalDays As Long
dDate = Form_frmModifyInvoiceClient.lstModify.Column(1)
dtDiff = DateDiff("d", Format(dDate, "mm/dd/yyyy"),
Format(Now(), "mm/dd/yyyy"))
nLeapYearOfBillYear = DatePart("yyyy", Format(dDate,
"dd/mm/yyyy"))
nLeapYearOfBillYear = nLeapYearOfBillYear Mod 4
nLeapYearNow = DatePart("yyyy", Format(Now(), "dd/mm/yyyy"))
nLeapYearNow = nLeapYearNow Mod 4
If nLeapYearNow = 0 Or nLeapYearOfBillYear = 0 Then
nTotalDays = 180
Else
nTotalDays = 180
End If
If dtDiff > nTotalDays Then
cmdClose.SetFocus
subLockControls False, True
bLockFlag = True
Else
subLockControls True, False
End If
End If
End Sub
are greyed out
bModify = True
Dim dDate As Date
Dim dtDiff
Dim nCountDaysOfYear As Long
Dim nLeapYearNow As Long, nLeapYearOfBillYear As Long
Dim nTotalDays As Long
dDate = Form_frmModifyInvoiceClient.lstModify.Column(1)
dtDiff = DateDiff("d", Format(dDate, "mm/dd/yyyy"),
Format(Now(), "mm/dd/yyyy"))
nLeapYearOfBillYear = DatePart("yyyy", Format(dDate,
"dd/mm/yyyy"))
nLeapYearOfBillYear = nLeapYearOfBillYear Mod 4
nLeapYearNow = DatePart("yyyy", Format(Now(), "dd/mm/yyyy"))
nLeapYearNow = nLeapYearNow Mod 4
If nLeapYearNow = 0 Or nLeapYearOfBillYear = 0 Then
nTotalDays = 180
Else
nTotalDays = 180
End If
If dtDiff > nTotalDays Then
cmdClose.SetFocus
subLockControls False, True
bLockFlag = True
Else
subLockControls True, False
End If
End If
End Sub