• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 855
  • Last Modified:

Access XP Popup Form_GotFocus/Form_Activate

Problem:
Access (2k2/XP) Form_GotFocus and Form_Activated are not firing when a form is a popup; but that's what I need. Anyone know a workaround/solution? While I'm here; is this a "bug" or a "design feature", and if so.. why!?

Background:
I've a main "continuous" form displaying multiple records. I've a toggle button to load a **popup** window displaying data relevant to the current record on the continuous form, this popup may be multiply instantiated. The toggle button refreshes On_Current, and the relevant popup form is "SetFocus"ed. This all works fine. Now I want to do the reverse...

If I, by mouse, SetFocus on one of the popup forms I want the cursor location on the main continuous form to move to the relevant record. However, Form_GotFocus/Form_Activated are not firing as the forms are popups. I really don't want to change the popup forms to be normal forms if possible, but can anyone suggest a way around the lack of Form_GotFocus/Form_Activated event?

Many thanks in anticipation

Justin
0
9swampy
Asked:
9swampy
  • 3
  • 2
1 Solution
 
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)Commented:
Apparently the On Activate Event does not trigger with Popup is True ... I just tried that.  I don't use Activate that often, so I had not noticed this before.

Here is your workaround:

Turn off Popup and/or Modal.

Then use this code to open your form.

Private Sub Command10_Click()
    DoCmd.OpenForm "YourFormName"
    Do
        DoEvents    'VERY IMPORTANT
    Loop Until CurrentProject.AllForms("YourFormName").IsLoaded = False
End Sub

Note also ... the Form_GotFocus will only trigger if the form has No controls ... as mentioned in the Help file.

mx
0
 
9swampyAuthor Commented:
Thanks mx, but unfortunately turning off popup defeats the purpose. I need to be able to allow the users to continue to use real-estate beyond the bounds of the main Access window. I can retrieve "correct" Form_GotFocus & Form_Activate behaviour by simply turning off pop-up and have code that does all the refreshing correctly, but it's the pop-up functionality I'm hoping to retain.
0
 
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)Commented:
9s .... what I posted sort of emulates Popup/Dialog ....  no additional code will be executed from the calling form until your popup form is closed.

mx
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
9swampyAuthor Commented:
Thanks mx, but unfortunately turning off popup defeats the purpose. I need to be able to allow the users to continue to use *screen-space* beyond the bounds of the main Access window.

I've just given in for now and forced my users to stay within the Access main window by turning off popup so I get the Form_[De]Activate events back again. They're not happy, I'm not happy, but by no means the first compromise I've had to make in my time!
0
 
9swampyAuthor Commented:
Noticed additionally that while popup = true if you explicitly reference the main form from the called form and attempt an oMainForm.Dirty = False then SQL Server gets totally locked out and I have to kill the application to get going again. Hmm. Useful.
0
 
Computer101Commented:
PAQed with points refunded (125)

Computer101
EE Admin
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now