Actually I have a lock on my invoices but it is not working it is meant to
lock 12 month old records but it does not, If you are in Jan07 it lockes
everthing back from Dec06, seems to me its just going back on the year adte
and not the 12 months, Here is part of my code:
'If the difference between InvoiceDate and currentDate
'is greater than one or more years then lock all controls
'of the forms therefore you can't edit or delete
'that old Invoice.
Dim dDate As Date
Dim dtDiff
Dim nCountDaysOfYear As Long
Dim nLeapYearNow As Long, nLeapYearOfBillYear As Long
Dim nTotalDays As Long
dDate = Form_frmModify.lstModify.Column(3)
'11 May 2006, Dnyanada Varude.
'Fixed the error of Date difference.
dtDiff = DateDiff("d", Format(dDate, "mm/dd/yyyy"),
Format(Now(), "mm/dd/yyyy"))
'11 May 2006, Dnyanada Varude.
'Fixed the error of Date difference.
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 = 366
Else
nTotalDays = 365
End If
If dtDiff > nTotalDays Then
cmdClose.SetFocus
subLockControls False, True
bLockFlag = True
Else
subLockControls True, False
End If