How to unable button on form

luzz

Registered User.
Local time
Today, 06:47
Joined
Aug 23, 2017
Messages
346
How to disable button on form

Hello guys, how do i disable my edit button on my form after clicking on "Save" or "Clear" on my form?
 

Attachments

  • form.png
    form.png
    7.2 KB · Views: 146
Last edited:
Add the following line to the Save and Clear button event code

Code:
 Me.cmdEdit.Enabled = False

Where cmdEdit is the button's name - modify to match yours.
 
Add the following line to the Save and Clear button event code

Code:
 Me.cmdEdit.Enabled = False

Where cmdEdit is the button's name - modify to match yours.

Sorry, I think I did not express myself clearly. I want my button to look (at the picture below) like that when i open my form and after i have click save.
 

Attachments

  • button.png
    button.png
    2.1 KB · Views: 143
Well I thought I'd already answered that!

Code:
Me.cmdEdit.Enabled = False
disables the Edit button

Code:
Me.cmdEdit.Enabled = True
enables the button

In design view make sure the button is ENABLED.
Save the form
When you next open the form the button will be ENABLED

Then in the code for the Save button, add the following line to disable the button
Code:
Me.cmdEdit.Enabled = False

If you are using macros instead of VBA code, I can't help you as I don't use them.

Good luck with your project (for both current threads)
 
Well I thought I'd already answered that!

Code:
Me.cmdEdit.Enabled = False
disables the Edit button

Code:
Me.cmdEdit.Enabled = True
enables the button

In design view make sure the button is ENABLED.
Save the form
When you next open the form the button will be ENABLED

Then in the code for the Save button, add the following line to disable the button
Code:
Me.cmdEdit.Enabled = False

If you are using macros instead of VBA code, I can't help you as I don't use them.

Good luck with your project (for both current threads)

Thanks! It works, but how i click on 'Save" button and the records on the from will automatically clear and the "Edit" button will be able again? Currently, when i save my record after editing, i will have to click on clear button before i can proceed to use the edit button to edit the record that i have selected in my subfrom? By the way, i am using VBA code;)
 
Thanks! It works, but how i click on 'Save" button and the records on the from will automatically clear and the "Edit" button will be able again? Currently, when i save my record after editing, i will have to click on clear button before i can proceed to use the edit button to edit the record that i have selected in my subfrom? By the way, i am using VBA code;)

Sigh ....
In that case there is no point disabling the Edit button ...
I'm sure you can work out the logic you need and just attach the relevant code to whatever button you think best

Over & out
 

Users who are viewing this thread

Back
Top Bottom