Disable Command Button

  • Thread starter Thread starter Daniel
  • Start date Start date
D

Daniel

Is it possible to disable a command button when a form is opened with
acFormReadOnly?

I have a form that is opened in Read Only to allow the user to view history
data so it cannot be changed. I am using the same form that allows the user
to enter data when opened normally. Instead of creating a whole seperate
form, I need to disable the save and add record buttons so they cannot click
on it and get the not availible message. Any suggestions/solutions would be
greatly appreciated.

Thanks,

Daniel
 
Is it possible to disable a command button when a form is opened with
acFormReadOnly?

I have a form that is opened in Read Only to allow the user to view history
data so it cannot be changed. I am using the same form that allows the user
to enter data when opened normally. Instead of creating a whole seperate
form, I need to disable the save and add record buttons so they cannot click
on it and get the not availible message. Any suggestions/solutions would be
greatly appreciated.

You can check the .AllowEdits and .AllowAdditions properties of the form in the
"On Open" event procedure and set the enabled state of the command buttons
accordingly.
 
You can check the .AllowEdits and .AllowAdditions properties of the form in the
"On Open" event procedure and set the enabled state of the command buttons
accordingly.

Just make sure that the focus is not on anything that you will disable or hide
or you will get a runtime error - you can simply .SetFocus to another control
first.
 
Back
Top