Avatar of Bernard Thouin
Bernard ThouinFlag for Switzerland asked on

Stuck with untrappable error in Access app

Hi

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 ?

Bernard
* ADOMicrosoft Access

Avatar of undefined
Last Comment
Mark Edwards

8/22/2022 - Mon
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.
John Tsioumpris

Have you checked your References for something missing/broken ?
Mark Edwards

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.
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
Fabrice Lambert

Make an autoexec macro that run a VBA function that will:
- Check for linked tables.
- Once ok, open the main form.
ASKER
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.

Bernard
ASKER CERTIFIED SOLUTION
Bernard Thouin

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
ASKER
Bernard Thouin

Thanks for your time, guys.
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
Mark Edwards

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....