How do I make the button enabled?

raghuprabhu

Registered User.
Local time
Today, 14:27
Joined
Mar 24, 2008
Messages
154
In the form of the attached database both the “Update” button and the “Insert” button will be enabled when all the fields are input.

I want to enable only one button at a time.

When the check box “Enable Update” is checked I want the “Update” button to be enabled and when the check box “Enable Insert” is checked I want the “Insert” button to be enabled.

How do I do it?

Thanks
 

Attachments

put this code in the CheckBox AfterUpdate event:
me.btnToEnable.enabled = me.CheckBox.value
 
This suggestion is not working. The buttons will be enabled only if all the text boxes are filled.

Cheers
Raghu
 
When the check box “Enable Update” is checked I want the “Update” button to be enabled and when the check box “Enable Insert” is checked I want the “Insert” button to be enabled.

How do I do it?
Thanks
the code I wrote should work for what you asked for.
or you better explain what you want
 
You also need the code smig gave you in the Current event of the form.
 
the Update Command Button Enabled when Values have been entered into all Fields AND the Enable Update Check Box is Selected

Same scenario for the Insert Command Button/Enable Insert Check Box
 
*** edit ***
call this code form your checkBox after_update events, all TextBox after_update events and form the on_current event

Code:
private sub SetControls()
 
dim ctrl as control
 
     me.UpdateBtn.enabled = True
     me.InserBtn.enabled = True
 
if me.EnableUpdateBtn = False then
     me.UpdateBtn.enabled = False
end if
 
if me.EnableInsertBtn = False then
     me.InsertBtn.enabled = False
end if
 
for each ctrl in me.conrols
  if ctrl.ControlType = acTextBox AND null(ctrl.value) then
     me.UpdateBtn.enabled = False
     me.InsertBtn.enabled = False
     exit for
  end if
next ctrl
 
End Sub
 
Last edited:
you'r welcome :)
glad we could help
 

Users who are viewing this thread

Back
Top Bottom