how to trap the error msg when application start (1 Viewer)

jamest85

Registered User.
Local time
Today, 09:36
Joined
Jan 20, 2008
Messages
52
Hi:

My Access (A.mdb) application has linked tables which are located in another Access(B.mdb).

If the location of the B.mdb is not correct, the application (A.mdb) will pop up an error msg: "Datebase Startup: Could not find file: "C\Users\correctPath\B.mdb", error Number: 3024.

Can I trap this error msg and change my own msg?

Thanks a lot.

James
 

bohemian9485

Registered User.
Local time
Tomorrow, 00:36
Joined
Jun 28, 2009
Messages
17
You can use On Error Goto line in your startup form's Open event
 
Last edited:

jamest85

Registered User.
Local time
Today, 09:36
Joined
Jan 20, 2008
Messages
52
You can use On Error Goto line in your startup form's Open event

thanks for your help.

However, Open event (or Load event) doesn't work, still show the error message without going to that event.

Any other suggestion?

Thanks.
 

boblarson

Smeghead
Local time
Today, 09:36
Joined
Jan 12, 2001
Messages
32,059
thanks for your help.

However, Open event (or Load event) doesn't work, still show the error message without going to that event.

Any other suggestion?

Thanks.
The only thing you can do is to use an AutoExec Macro to run code to make sure the links are intact. The AutoExec macro is the only thing that runs BEFORE the links are tested by Access.

Check out this ReLinker provided by MVP Armen Stein.
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 17:36
Joined
Sep 12, 2006
Messages
15,757
what i do is try to do a dlookup on a field i know should exist to ensure the tables are connected

so, this sort of thing ...

on error goto notlinked
progversion = dlookup("myversion","mastertable")
exit sub

notlinked:
msgbox("The tables are not linked")

---------
note that this will also fail if the table is connected, but the fieldname is wrong - but this should give you a way of proceeding
 

Users who are viewing this thread

Top Bottom