Disabling a Control Button

  • Thread starter Thread starter Jeff Harbin
  • Start date Start date
J

Jeff Harbin

I've written a procedure that takes quite a while to run
in the background. I would like to disable the Close form
button at the beginning of the routine and then re-enable
it at the end. I want to do this so that the user won't
think the program has stopped and press the Close form
button.

I've disabled buttons before so I don't understand what my
problem is. I think I've got a bad reference.

What I'm seeing that is abnormal is..

1) When I am typing Me.CloseButton.Enable=False, I get the
drop down list after pressing the "." after "Me"
and "CloseButton is in the list. However, after I
select "CloseButton" from the list and type the next ".",
I do not get a list of properties associated with that
control.

When I try to test the program, I get an error message
saying there is an "Invalid Qualifier", the code stops
running, and if I select Debug it takes me to the button
name - "CloseButton".

What am I doing wrong. The references that I've got
selected are ...

Visual Basic for Applications
Microsoft Access 9.0 Object Library
OLE Automation
Microsoft ActiveX Data Objects 2.1 Library
Microsoft DAO 3.6 Object Library
 
Hi Jeff,

notice that it is
CloseButton.enabled=false

ie endeds with d
not
CloseButton.enable=false

as you have spelt it in your posted code example

luck
Jonathan
 
Jeff Harbin said:
I've written a procedure that takes quite a while to run
in the background. I would like to disable the Close form
button at the beginning of the routine and then re-enable
it at the end. I want to do this so that the user won't
think the program has stopped and press the Close form
button.

I've disabled buttons before so I don't understand what my
problem is. I think I've got a bad reference.

What I'm seeing that is abnormal is..

1) When I am typing Me.CloseButton.Enable=False, I get the
drop down list after pressing the "." after "Me"
and "CloseButton is in the list. However, after I
select "CloseButton" from the list and type the next ".",
I do not get a list of properties associated with that
control.

When I try to test the program, I get an error message
saying there is an "Invalid Qualifier", the code stops
running, and if I select Debug it takes me to the button
name - "CloseButton".

What am I doing wrong. The references that I've got
selected are ...

Visual Basic for Applications
Microsoft Access 9.0 Object Library
OLE Automation
Microsoft ActiveX Data Objects 2.1 Library
Microsoft DAO 3.6 Object Library

"CloseButton" is the name of a property of the form, so when you write
"Me.CloseButton", that's what Access thinks you're referring to. Name
your command button something else; for example, "cmdClose". Then you
should have no trouble with the VBA statement

Me.cmdClose.Enabled = False
 
Back
Top