Bob Quintal <bq******@generation.net> wrote in
news:50******************************@news.teranew s.com:
"Deano" <ma************@hotmail.com> wrote in
news:rC*******************@wards.force9.net:
Hi,
I need to disable a command button at some point. Easy
enough. Initially in design view it is set as enabled.
Now once I disable it, how can I ensure that when the app is
restarted, the Enabled property in design view is now set to
disabled (i.e Enabled = No).
I don't want to track this using a flag in a table if at all
possible and the final app is an MDE. I suspect this can't
be done but any comments would be welcome.
Interesting issue. I believe that the doCmd.Deleteobject works
in an .mde. How about setting the control disabled in design
view and putting some code executed from the autoexec macro or
welcome form that enables it. The code would test the
existence of some object in the database, such as a query.
Once the query is deleted, the control no longer can be
enabled.
Bob Q
I got creative. I created a macro that sets the command button
enabled = true. Called the macro from the form.open event inside an
error handler that traps the "Object does not exist error".
Added a button that calls the .deleteobject on that macro. I made
that invisible.
Modified the macro to set the new button visible.
Made mde. Tested.
After clicking on the delete button, closing and reopening the
form, the first button was disabled and the second was hidden.
Bob Q