Private Sub Form_Current()
On Error Resume Next
Dim ctls As Controls
Dim ctlCur As Control
Dim fEnabled As Boolean
Dim i As Integer
If Me![Date] >= Date - 10 Then
fEnabled = Not (Me![Verify Release] Or Me![Op Verify Release] Or Me![RS Verify Release])
Set ctls = Me.Controls
For i = 1 To ctls.Count
Set ctlCur = ctls(i)
ctlCur.Enabled = fEnabled
'ctlCur.Locked = Not fEnabled
Next i
Command55.Enabled = True
Command56.Enabled = True
Command57.Enabled = True
End If
End Sub
I have inherited a database and basically I am having some trouble with getting the controls to disable by date.
The form is to verify a release and when it needs releasing they currently have to tick a tickbox and it will disable all of the controls on the form so no-one can tamper with it after it has been verified.
But they now want this to be automatically done for one department by date as they forget to verify their releases. So i need all the release record controls disabled for each record which is 10 days old.
I have tried adding in a date part and removing parts of the code but i cant get it to work.Im struggling with this as im new to vba, so any help would be greatly appreciated
Thanks in advance
Vicky
On Error Resume Next
Dim ctls As Controls
Dim ctlCur As Control
Dim fEnabled As Boolean
Dim i As Integer
If Me![Date] >= Date - 10 Then
fEnabled = Not (Me![Verify Release] Or Me![Op Verify Release] Or Me![RS Verify Release])
Set ctls = Me.Controls
For i = 1 To ctls.Count
Set ctlCur = ctls(i)
ctlCur.Enabled = fEnabled
'ctlCur.Locked = Not fEnabled
Next i
Command55.Enabled = True
Command56.Enabled = True
Command57.Enabled = True
End If
End Sub
I have inherited a database and basically I am having some trouble with getting the controls to disable by date.
The form is to verify a release and when it needs releasing they currently have to tick a tickbox and it will disable all of the controls on the form so no-one can tamper with it after it has been verified.
But they now want this to be automatically done for one department by date as they forget to verify their releases. So i need all the release record controls disabled for each record which is 10 days old.
I have tried adding in a date part and removing parts of the code but i cant get it to work.Im struggling with this as im new to vba, so any help would be greatly appreciated
Thanks in advance
Vicky