Run procedure any time ANY Form is opened? (1 Viewer)

Meltdown

Registered User.
Local time
Today, 18:10
Joined
Feb 25, 2002
Messages
472
I have an old database I need to clean up and I want to see what Forms are still being actively used. So, I'm going to create a log table and, if a Form is opened, log that event.

I could write a public procedure -- open every Form and call the procedure in the OnOpen() event -- but, I was wondering if there is a way to capture Forms that are opened without hard-coding into each Form?

Regards
Melt
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 02:10
Joined
May 7, 2009
Messages
19,169
have a pop up form with timer event and open it hidden. you can do this through autoexec macro.

put this code on the Timer procedure:

private sub Form_Timer()

dim objAccess as AccessObject

For each objAccess In CurrentProject.AllForms
If objAccess.IsLoaded Then
If objAccesst.CurrentView <> acCurViewDesign And objAccess.Name <> Me.Name Then
' the form is loaded
' your code goes here to save, the name of the form is in objAccess.Name
End If
End If
Next
Set objAccess = Nothing
End sub
 

Meltdown

Registered User.
Local time
Today, 18:10
Joined
Feb 25, 2002
Messages
472
Thanks a lot arnelgp, that'll work.

Reagrds
Melt
 

Users who are viewing this thread

Top Bottom