Runtime properties sometimes get saved to form

  • Thread starter Thread starter bdtmike
  • Start date Start date
B

bdtmike

I haven't figured out why this is happening. Perhaps someone else
does. On occasion, runtime changes made to properties on my form or
its controls get saved permanantly to the form design.

For example, I have a form and it has 2 buttons--both of which are
disabled in the design view. During the course of using the form,
these buttons may be enabled, depending on whether they are valid.
Then something happens--during the close of the form, perhaps. When
the form is reopened, those buttons are enabled. Go into the design
view and you will find that these buttons are enabled. This happens to
many other properties as well.

Anybody have this happen or know how to prevent it?
 
Yes, have seen this.

The most obvious possibility is we are switching to design view at some
point after opening, and then the properties are saved as they were at that
point. It's not supposed to happen if you
DoCmd.Close acForm, Me.Name, acSaveYes
but perhaps some of these properties do get saved that way.

The best workaround is to use the Open or Load event of the form to
initialize things the way you want them. Something like this:
Private Sub Form_Load()
Me.[Somebutton].Enabled = False
'etc
End Sub
 
Well, I have some rather elaborate forms in my app. There's a lot of
controls to turn on/off, color settings, etc. What it comes down to is
you can't rely on your design changes sticking and that's a problem.
 
Back
Top