I have a very large form where I have added three command buttons:
Undo - Save - Close
I want the Undo & Save Button to be disabled until the form becomes dirty when a record has been changed. Then the Undo & Save buttons become enabled and the Close button becomes disables until one of the Undo & Save buttons is selected.
At the moment I am using the following code in the "On Timer" event of the form which seems to be working sometimes but not all the time and I have read that using the "On Timer" is not the best solution for alot of code.
Here's my code:
Private Sub Form_Timer()
On Error Resume Next
Static bFlag As Boolean
If Me.Dirty Then
If Not bFlag Then
Me!btnUndo.Enabled = True
Me!butSave.Enabled = True
Me!ExitPropertiesForm.Enabled = False
bFlag = True
End If
Else
If bFlag Then
'Me.ViewReports.SetFocus
Me!btnUndo.Enabled = False
Me!butsave.Enabled = False
Me!ExitPropertiesForm.Enabled = True
bFlag = False
End If
End If
End Sub
------------------------------------------------------------------------------------------------------------
should I be using something similar to this in a different event (e.g After Update event)