OnGotFocus on a popup form

A

aaronk23

i am trying to trigger some code to run when a popup form gets focus or
is activated. the trouble is these 2 events do NOT trigger (access
'disables' them) when a form's Popup property is Yes.

any ideas?
 
G

Guest

It has nothing to do with the form being a popup. Here is text copied
directly from Help:
A form can receive the focus only if it has no controls or if all visible
controls are disabled. If a form contains any visible, enabled controls, the
GotFocus event for the form doesn't occur.
And:
The Activate event doesn't occur when a form receives focus back from a
dialog box, popup, or another form.
 
A

aaronk23

thanks for the reply.

more simply put, how do i trigger code when i move back to my form that
happens to have the Popup property set to Yes.
 
G

Guest

You are correct about the Popup blocking the Activate event. I tried a few
tricks, but I can't make it run any code for the form.
I'm sure there is a way, maybe someone else might know a trick to get around
this problem.
One question, what is it you want to do when the focus goes back to the
popup? Do you also want to do the same thing the first time the form is
opened?
 
A

aaronk23

i have a bunch of combo boxes that i want to requery. i have a bite of
code that cycles thru them and requeries them. i want to run it each
time i activate the form.

if i turn off the Popup, it works fine....as you discovered.
 
G

Guest

Aha! I think this will work. I tried a little test, but it may not work like
you want it to. In the form that opens the popup, I open the form with a
command button, then manipulate some controls on the popup in the click event
of the calling form:
DoCmd.OpenForm "ztester"
Forms!ztester!Text9 = Forms!ztester!Text9 + 1

Each time I click the command button on the calling form, the value
increments as expected; however, just moving from form to form doesn't do it.

I don't know of anything else to try.
 
A

aaronk23

thanks for trying. i may just add a 'Refresh' button until i the magic
bullet happens to whiz by my head. (i am a fan of automation whereever
feasible...and this seems feasible).
 
G

Guest

Hi Aaron,
I am running into a similar problem that you described in this thread. I
have a form with a grid containing recs on it. When a user selects a record
in this grid a maint form appears so they can edit the record. This maint
form has the properties popup = y, modal = n because I want them to be able
to move the maint screen around and see the recs in the grid in the form
underneath, and maybe interact with it while maint screen up (i.e. resort
recs in grid). In any case, once they update the rec in the maint form, the
user is brought back to the form with the grid in it but I can't figure out
how to refresh the recs in the grid with the newly updated data (the activate
event does not get executed). I've tried everything I could think of but my
only solution is to do what you suggested - add a refresh button. I was
wondering if the magic bullet happened to whiz by your head so you could
share some great solution to this problem. Any info is greatly appreciated.
Jackie
 

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