A form that is supposed to go away doesn't

Y

Yarik

Hi,

Recently stepped on the following fragment in the legacy code (only
relevant lines of code are left):

' In response to a click on some button
Private Sub cmdMyButton_Click()
Dim frmFoo as Form_Foo
Set frmFoo as New Form_Foo
Call frmFoo.SomeInitializationMethod(...)
frmFoo.Visible = True
End Sub

When this code runs in MS Access 2003, the form behaves exactly as I
would expect it to do: once a user presses the button, the Foo form
shows up for a split second and immediately disappears. Assuming that
frmFoo variable is the only reference to the instance of Foo form
created in event handler, this instance gets closed once this variable
goes out of scope. This is understandable, and this is how most of the
forms work both in Access 2003 and Access 2000...

Now, the problem is that this particular Foo form does not work that
way in Access 2000: instead of just flashing, it shows up on the
screen and does not go away. As if the frmFoo variable were no longer
the only reference to the form's instance. Since this form does go
away in Access 2003, I think that the problem is not in the legacy
code. I think the problem is somewhere in Access itself: something in
Access 2000 makes this form get referenced by something that seems to
be out of my control. What could it be? The form in question has two
subforms - could those subforms be responsible for such behavior in
Access 2000? If yes, then is it documented anywhere?

Please advise.

Thank you,
Yarik.
 
S

Stefan Hoffmann

hi Yarik,
The form in question has two
subforms - could those subforms be responsible for such behavior in
Access 2000? If yes, then is it documented anywhere?
Just test it with a form without subforms.

mfG
--> stefan <--
 
Y

Yarik

Just test it with a form without subforms.

I was about to test this, but we have started some software/hardware
upgrades in our team (including migration from MS Access 2000 to MS
Access 2003). It all took some time, and the problem remained
unattended. But now it has a new quirk...


Well, now this behavior changes without any visible reasons.

- A month ago or so, this form did not work (it disappeared as it is
supposed to).

- A couple of days ago I've finally got around to try to fix this bug,
but
to my great surprise found that it does "work" (i.e. just like it
did
under MS Access 2000). There were some changes to the ADP project
since
previous check, so I thought fine - I can probably defer fixing
this
problem... Or it just has gone away on its own once we had switched
from
Access 2000 to 2003 and started to compile the ADP using Access
2003...

- Well, today it does not work again! And this time I am sure that
there
were no any changes to the application since the previous check.

Really looks like some bug in Access...

If anyone experienced anything like this and knows the cure, I would
really, really appreciate that.

Thanks,
Yarik.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top