By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,635 Members | 913 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,635 IT Pros & Developers. It's quick & easy.

A2K - changing control property at runtime - is this possible?

P: n/a
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.

thanks
Martin
Nov 12 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
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

Nov 12 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.