469,927 Members | 1,820 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,927 developers. It's quick & easy.

Execute a function at database startup ... how?

Hi. I want to execute a routine, at database startup time, to relink
the backend tables. I have the code for the function, but I don't know
where to invoke it. I tried putting a call to the function in the Open
Event of the MainMenu (which gets displayed at Startup). That seems to
be too late, because I get an error that says that it can't find the
tables (I moved the backend file to a different folder, for testing of
this function).

What event is "kicked off" when the database starts up?

TIA.

Regards,
SueB

*** Sent via Developersdex http://www.developersdex.com ***
Nov 13 '05 #1
7 6590
My aplogies for the duplicate post. My system went weird here at work
and I didn't know if the original got posted or not. I don't think that
I can delete this post. So, again, my apologies.

Regards,
SueB

*** Sent via Developersdex http://www.developersdex.com ***
Nov 13 '05 #2
SueB wrote:
Hi. I want to execute a routine, at database startup time, to relink
the backend tables. I have the code for the function, but I don't know
where to invoke it. I tried putting a call to the function in the Open
Event of the MainMenu (which gets displayed at Startup). That seems to
be too late, because I get an error that says that it can't find the
tables (I moved the backend file to a different folder, for testing of
this function).

What event is "kicked off" when the database starts up?

TIA.

Regards,
SueB

*** Sent via Developersdex http://www.developersdex.com ***


See my reply in your other message
Nov 13 '05 #3
The autoexec macro would run first.

You can use the RunCode command to have it run a function (if it's a Sub,
you'll have to either change it to a public function or create a Sub that
calls it).

HTH,

Bruce

"SueB" <sl*****@verizon.net> wrote in message
news:OE***************@news.uswest.net...
Hi. I want to execute a routine, at database startup time, to relink
the backend tables. I have the code for the function, but I don't know
where to invoke it. I tried putting a call to the function in the Open
Event of the MainMenu (which gets displayed at Startup). That seems to
be too late, because I get an error that says that it can't find the
tables (I moved the backend file to a different folder, for testing of
this function).

What event is "kicked off" when the database starts up?

TIA.

Regards,
SueB

*** Sent via Developersdex http://www.developersdex.com ***

Nov 13 '05 #4
Bruce Rusk wrote:
The autoexec macro would run first.


Actually the Open, Load, and Current event of a form designated to open in
startup fire before the Autoexec macro.

--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com
Nov 13 '05 #5
That's good to know.

In that case, to resolve the OP's problem, it might make sense to run the
necessary code from Autoexec first, then have Autoexec open the form,
instead of setting a startup form.

"Rick Brandt" <ri*********@hotmail.com> wrote in message
news:iC*******************@newssvr14.news.prodigy. com...
Bruce Rusk wrote:
The autoexec macro would run first.


Actually the Open, Load, and Current event of a form designated to open in
startup fire before the Autoexec macro.

--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com

Nov 13 '05 #6
Help ... I have the AutoExec macro calling a function to determine if we
should 'relink' the tables. I didn't really know how to do this, so I
put a variable in a table that I have for User Variables to gate whether
the Refresh Links should take place.

Of course this really won't work if the links have been broken because
the table won't be there. But I forged ahead just to give is try (with
the Back-end and Front-end where there are expected to be).
Unfortunately, when I try to get the variable value (the switch = Y or
N) I get an error that says that I "canceled the previous operation".
Wow - this has got me stumped.

I want to ONLY refresh the links if, when the database opens it can't
find the tables. I want it to be executed via VB code. I like the idea
of the database opening with AutoExec Macro which will run code to
refresh the links and then OpenForm for the MainMenu window.

Any ideas would be REALLY appreciated.

Thanks.
SueB

Regards,
SueB

*** Sent via Developersdex http://www.developersdex.com ***
Nov 13 '05 #7
hey

if you use ACCESS DATA PROJECTS then you dont have to worry about all
this re-linking BS

no linked tables; all the queries are stored in SQL Server-- it's just
a much better solution

Nov 13 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

9 posts views Thread by Penn Markham | last post: by
2 posts views Thread by Indrek Mägi | last post: by
1 post views Thread by pginfo | last post: by
3 posts views Thread by Lyle Fairfield | last post: by
1 post views Thread by =?Utf-8?B?S2Vubnk=?= | last post: by
3 posts views Thread by fniles | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.