Suppress Error message

  • Thread starter Thread starter Karen Hagerman
  • Start date Start date
K

Karen Hagerman

I have a front-end with a back-end database. On the front-end I open a form
when the front end opens to check the integrity of the linked tables. I
can't past the 'built-in' Access warning that it can't find the tables to
run the integrity check. If the linked tables aren't found by the integrity
check then I have another from open so the user can select the back-end to
link to.

How can I suppress the 'built-in' Access warning so I can get to my own
integrity check and solution?

Is there an OnOpen event for the front-end database itself and, if so, how
do I find it in the VBA editor to write my code?
 
Hi Karen

First, there is no Open event for a database. There are two ways to execute
code when a database is opened:
1. Put your code in a public function called, say "Database_Open" in
a standard module and create a macro named "AutoExec".
In the macro, you need a single action:
RunCode Database_Open()
(This is the only thing I ever use a macro for!)
2. Create a form with a Form_Load event and specify that form as your
startup form in Tools>Startup.

I'm guessing that your "integrity check" form is bound to table(s) in your
back-end, so when you open the form it cannot find its bound data. Do these
tables contain information about the other linked tables in your
application? If so, then you should move them to your front-end, as they
are really part of your app, not part of your data.

If they are really data tables that belong in your back-end, then your form
should not be bound to them.

I suggest you run code in your Database_Open function which attempts to open
a recordset on each of the linked tables in turn. (It will run a lot faster
if you keep the first one open while you check the rest.) If this check
fails, then you can ask the user for the location of the back-end.
 
Graham,

Thanks so much for responding. As it turned out, I did have everything OK
and if I had read the error message I would have seen that my shortcut was
messed up, not my code.

I do have a hidden form frmCheckLinks and I have it set to open when the
database opens.

Anyway, definitely my bad but it's great to know people who will respond :)

--
Karen
Hi Karen

First, there is no Open event for a database. There are two ways to execute
code when a database is opened:
1. Put your code in a public function called, say "Database_Open" in
a standard module and create a macro named "AutoExec".
In the macro, you need a single action:
RunCode Database_Open()
(This is the only thing I ever use a macro for!)
2. Create a form with a Form_Load event and specify that form as your
startup form in Tools>Startup.

I'm guessing that your "integrity check" form is bound to table(s) in your
back-end, so when you open the form it cannot find its bound data. Do these
tables contain information about the other linked tables in your
application? If so, then you should move them to your front-end, as they
are really part of your app, not part of your data.

If they are really data tables that belong in your back-end, then your form
should not be bound to them.

I suggest you run code in your Database_Open function which attempts to open
a recordset on each of the linked tables in turn. (It will run a lot faster
if you keep the first one open while you check the rest.) If this check
fails, then you can ask the user for the location of the back-end.
 
Back
Top