Active/Not Active button depend from condition

eugz

Registered User.
Local time
Today, 04:49
Joined
Aug 31, 2004
Messages
128
Hi All.
I created form with some fields, RESET and QUIT buttons. All works fine. But with RESET button I have problem. I would like when user open new form RESET will be not active. Only when user open new record or did some changes on existing record in that case RESET becoming active and after click on existing record delete value(s) of a field(s) only where user tried to do changes but did error.
Thanks.
 
assuming a button called btCancel then
Code:
Private Sub btCancel_Click()
Me.Undo
End Sub

Private Sub Form_Current()
Me.btCancel.Enabled = False
End Sub

Private Sub Form_Dirty(Cancel As Integer)
Me.btCancel.Enabled = True
End Sub

hth

peter
 
Hi. Thanks Peter.
My question is how to create conditions to get a result in my cases.
Thanks.
 
Private Sub Form_Current()
Me.btCancel.Enabled = False
End Sub

will turn off the button every time you change record.

Private Sub Form_Dirty(Cancel As Integer)
Me.btCancel.Enabled = True
End Sub

will turn the button on when something changes on the form.

Peter
 

Users who are viewing this thread

Back
Top Bottom