Link to home
Start Free TrialLog in
Avatar of Bernard Thouin
Bernard ThouinFlag for Switzerland

asked on

Stuck with untrappable error in Access app


I get a weird error in an Access app which was working before, when starting the main form, which is trying to bind to a remote DB2/400 DB using a connection string and ADO.

The error is "Could not find file 'C:\Users\MyUser\Documents\<DB2 DB name>.mdb'

And it happens BEFORE anything else, before the form Load or the Form Open event, I cannot trap it although I have set break points on the first statement of each routine in the form ! It's extremely frustrating. Even more frustrating is that the form worked, not quite as I wanted, I changed something, I can't remember what, and now this happens and I am totally stuck.

I had this error once when qualifying the table name I'm trying to bind to the form with the DB name, but now, regardless if I qualify or not the table name, it bombs out, and even before any code has been executed, seemingly !

Anyone can help ?

Avatar of Daniel Pineault
Daniel Pineault

Sounds like you have linked tables for which the connection source cannot be found/accessed.  Just because they appear in the list of tables doesn't mean they are functional.

It always best to have some automated validation or relinking mechanism run at the very startup of any Access database prior to accessing any data to ensure that all the links are functional, otherwise report the issue to the user and close the database, or permit them to perform the relink or use automation to do so.

The fact that the issue arises prior to form load/open means the form is bound to one of the tables or one of it's controls are and the table in not accessible.  Check you linked tables to validate their status.
Have you checked your References for something missing/broken ?
In general, "untrappable" errors are caused by factors other than VBA code, such as a bound object, form, control, linked table, linked file, image, reference, etc. that Access needs to use but can't find, especially if they are occurring before any VBA code runs.

You'll need to look in all the places where the file mentioned in the error message is needed, including References.
Make an autoexec macro that run a VBA function that will:
- Check for linked tables.
- Once ok, open the main form.
Avatar of Bernard Thouin


Hi guys

I am a seasoned Acces developer, not a newbie. I wouldn't ask my question if I had not checked everything before.

I neither have broken links nor broken references. I can open all my linked tables witout any single problem. I have automated re-linking at startup in all my apps, i.e. also in this one. However that happens with VBA code, and I'm not even coming that far, as mentioned in my question.

@Mark: "the file mentioned in the error message" is NOT existing and will NEVER exist, it's a porkie created by Access by taking the name of the remote DB2/400 database and sticking ".mdb" at the end !

However, today, after a change of the form source in design view (from a full select to just the table name), the form at least opens, but I get further problems, which will be the subject of a new question.

Avatar of Bernard Thouin
Bernard Thouin
Flag of Switzerland image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks for your time, guys.
As I mentioned in my previous post, a form's bound recordsource is one of those items that run without VBA and can cause "untrappable" errors if it tries to run before any VBA tries to run.  If you ever get an "untrappable" error, be sure and check ALL bound forms and controls that may run during the part of the app operation where you are experiencing the error.

Guess this was the one item that you didn't previously check....