D
delboyspurs
Guest
Hi,
Im new to this, and a beginner at database design, but I am currently stuck on disabling a command button.
Basically what happens is the form is loaded and there are two buttons (save and undo) both disabled:
Private Sub Form_Current()
Me!cmdSaveAddAd.Enabled = False
Me!cmdCancelAddNewAd.Enabled = False
End Sub
once a text box has been filled in the next occurance happens:
Private Sub Form_Dirty(Cancel As Integer)
Me!cmdCancelAddNewAd.Enabled = True
Me!cmdSaveAddAd.Enabled = True
End Sub
which enables both buttons. but the problem is when a user clicks the undo button i want both buttons to be disabled again, i cannot get the undo button disabled, the save button was easy enough:
Private Sub cmdCancelAddNewAd_Click()
DoCmd.RunCommand acCmdUndo
Me!cmdSaveAddAd.Enabled = False
End Sub
but if i put (Me!cmdCancelAddNewAd.Enabled = false) i get an error message saying 'you cannot disable a control that is in focus'.
i have tried numerous things but i cannot find a solution. Please help!!!
Regards
Luke
Im new to this, and a beginner at database design, but I am currently stuck on disabling a command button.
Basically what happens is the form is loaded and there are two buttons (save and undo) both disabled:
Private Sub Form_Current()
Me!cmdSaveAddAd.Enabled = False
Me!cmdCancelAddNewAd.Enabled = False
End Sub
once a text box has been filled in the next occurance happens:
Private Sub Form_Dirty(Cancel As Integer)
Me!cmdCancelAddNewAd.Enabled = True
Me!cmdSaveAddAd.Enabled = True
End Sub
which enables both buttons. but the problem is when a user clicks the undo button i want both buttons to be disabled again, i cannot get the undo button disabled, the save button was easy enough:
Private Sub cmdCancelAddNewAd_Click()
DoCmd.RunCommand acCmdUndo
Me!cmdSaveAddAd.Enabled = False
End Sub
but if i put (Me!cmdCancelAddNewAd.Enabled = false) i get an error message saying 'you cannot disable a control that is in focus'.
i have tried numerous things but i cannot find a solution. Please help!!!
Regards
Luke