I
Irshad Alam
I want to Prevent User from Editing any changes on the record of Main form or
Subform if the below criteria meets :
If Date - Me.FormDt > 10 Then
'...dont let user to any changes on the record, show msg
End If
Main Form name is "AttdnFormA"
SubForm Name is "AttdnFormB"
Request to advise the codes in details, so that I can complete this job.
Because, it is very important data, the changes can be valid till 10 days, if
it 10 days expires, it will allow user to view or print but should allow user
to make any changes.
I tried the follwing code, the idea from help file, but failed :
Private Sub Form_Dirty(Cancel As Integer)
Dim ctlC As Control
If Date - Me.FormDt >10 Then
For Each ctlC In Me.Controls
ctlC.Value = ctlC.OldValue
Next ctlC
End If
End Sub
Please advise.
Regards.
Subform if the below criteria meets :
If Date - Me.FormDt > 10 Then
'...dont let user to any changes on the record, show msg
End If
Main Form name is "AttdnFormA"
SubForm Name is "AttdnFormB"
Request to advise the codes in details, so that I can complete this job.
Because, it is very important data, the changes can be valid till 10 days, if
it 10 days expires, it will allow user to view or print but should allow user
to make any changes.
I tried the follwing code, the idea from help file, but failed :
Private Sub Form_Dirty(Cancel As Integer)
Dim ctlC As Control
If Date - Me.FormDt >10 Then
For Each ctlC In Me.Controls
ctlC.Value = ctlC.OldValue
Next ctlC
End If
End Sub
Please advise.
Regards.