Before Form_Load (1 Viewer)

d_rool

Registered User.
Local time
Today, 17:49
Joined
Jun 10, 2008
Messages
11
Hi Guys

Is there an event fired as soon as I open the db even before Form_Load? Probably it is possible to do it with a module. I want to put some code inside to load a default form and disable the ribbon etc.


thx
 

d_rool

Registered User.
Local time
Today, 17:49
Joined
Jun 10, 2008
Messages
11
Would be great if you could describe a little bit in more detail.
 
Local time
Today, 02:49
Joined
Mar 4, 2008
Messages
3,856
Go to the Macros tab on the database window and create a new macro called "Autoexec". You can do all kinds of stuff with it, but since I don't use macros I can't tell you how.

Alternately, you can just set a default form to start and put your code in that default form's On Open event, if you prefer VBA.
 

RuralGuy

AWF VIP
Local time
Today, 01:49
Joined
Jul 2, 2005
Messages
13,826
I use the AutoExec macro to load a hidden form and then use the OnLoad and OnUnload events for all kinds of housekeeping chores.
 

Banana

split with a cherry atop.
Local time
Today, 00:49
Joined
Sep 1, 2005
Messages
6,318
I use the AutoExec macro to load a hidden form and then use the OnLoad and OnUnload events for all kinds of housekeeping chores.

Out of curiosity, how is that better than specifying that form as startup form? Will it always guarantee that this form open regardless what?
 

RuralGuy

AWF VIP
Local time
Today, 01:49
Joined
Jul 2, 2005
Messages
13,826
Actually I've been unsuccessful in getting a form to open hidden any other way.
 

Banana

split with a cherry atop.
Local time
Today, 00:49
Joined
Sep 1, 2005
Messages
6,318
Ah, thanks for sharing.

My method was simply to open a form that users would actually interact then on its Open event, open another form but hidden. Worked okay for my needs, as I was too afraid to touch macros after a nasty experience with one.
 
Local time
Today, 02:49
Joined
Mar 4, 2008
Messages
3,856
Macros in Access scare me. Not because of anything bad that might happen but because they're an unknown. When I started working in Access from an Excel background, I was surprised that a macro <> a macro.

That's why I would always tend to use a startup form.
 

RuralGuy

AWF VIP
Local time
Today, 01:49
Joined
Jul 2, 2005
Messages
13,826
My system had no opening form, just a menu bar so I had to find another way. The AutoExec macro is to only macro I've ever used. It is code all the way for me.
 

Banana

split with a cherry atop.
Local time
Today, 00:49
Joined
Sep 1, 2005
Messages
6,318
That would indeed make sense in that scenario. Too bad we didn't have Application-wide events or we wouldn't be having this discussion.

But you gotta do with what you've given. :)
 

Users who are viewing this thread

Top Bottom