AutoExec SUB dosn't work

J

Jeppe A

Hi all!

I'm trying to execute some code through ACCESS 2003 at startup but the
AutoExec SUB dosn't fire. Ant suggestions?

Thanks ALOT!
 
D

David C. Holley

Unless things have changed, you have to create a macro named Autoexec
which actually executes your code.
 
K

Ken Snell [MVP]

AutoExec SUB? If you're referring to the "AutoExec" that ACCESS will run
when it opens a database file, that is a macro that you create and name
"AutoExec". It's not a subroutine.
 
O

Oliver Seiffert

That's right,

and if you want to run code from the autoexec macro (you have to name it
autoexec), you can only use functions and not subs to be run.

Regards

Oliver Seiffert

Ken Snell said:
AutoExec SUB? If you're referring to the "AutoExec" that ACCESS will run
when it opens a database file, that is a macro that you create and name
"AutoExec". It's not a subroutine.
 
D

David C. Holley

If I'm not mistaken, any function or sub can be run from the AutoExec
macro regardlesss of how the module is named. The macro, however, must
be named AutoExec.

Oliver said:
That's right,

and if you want to run code from the autoexec macro (you have to name it
autoexec), you can only use functions and not subs to be run.

Regards

Oliver Seiffert

:
 
K

Ken Snell [MVP]

Douglas J Steele said:
I believe Oliver is correct. Macros can only run Functions, not Subs.

Yep. And the macro ignores the value returned by the Function.
 
M

MJatAflac

For what it's worth and at the risk of stating the obvious...

Even though you can only run a function from a macro, you can always call a
sub from the function...
--
Michal Joyce
Project Management IS Analyst
Aflac - Project Management Office
 
D

David C. Holley

Wether or not the SUB answers the call is of course another matter. (The
SUB could be in the shower or otherwise indiposed.)

Not entirely drunk at the momement.
 
D

Dirk Goldgar

David C. Holley said:
Wether or not the SUB answers the call is of course another matter.
(The SUB could be in the shower or otherwise indiposed.)

Not entirely drunk at the momement.

I can call SUBs from the vasty deep!

Why, so can I, or so can any man, but will they come?
 
D

David C. Holley

If you call them, they will come. (Especially if you ask them nicely and
promise not to give them one of my Grandmother's fruitcakes.)
 
Top