Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Detect GotFocus and/or OnActivate for Popup Form

Status
Not open for further replies.

darkangrydragon

IS-IT--Management
Jul 18, 2002
15
0
0
US
Hi!

I have a database that uses several forms, all of which have their Popup property set to Yes and their Modal property set to No.

I want to be able to detect when a user leaves one form and enters another form. However, when the popup property is set to Yes, the GotFocus and OnActivate events are not triggered for the form.

I have even tried using Hook procedures to detect focus and activation, but they, like the built in event handlers in Access, do not seem to trigger when switching between popup forms.

I would greatly appreciate any help! Thanks!

Best regards,
Andrew
 
Hi darkangrydragon,

What I've done in the past, though there is probably a cleaner method, is to use my Main Menu Form's Timer event:
Declare this in the Declarations section of a Module:
Public frmActiveForm as Form

In a Form that is always open, Menu/Switchboard Form's Timer event:
Set frmActiveForm = Forms(Screen.ActiveForm.Name)

Set the Timer Interval to 250 to check which form is currently the Active Form, 4 times a second. Adjust this to suit yourself. (1000) Once a second usually does me.

You would use frmActiveFormthe same as you would Forms!FormName, for example:
frmActiveForm!AControlName.SetFocus

Bill
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top