We help IT Professionals succeed at work.

Stuck with untrappable error in Access app

Bernard Thouin
on
84 Views
Last Modified: 2019-02-06
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
Comment
Watch Question

Daniel PineaultPresident / Owner CARDA Consultants Inc.
CERTIFIED EXPERT
Distinguished Expert 2018

Commented:
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 TsioumprisSoftware & Systems Engineer
CERTIFIED EXPERT
Distinguished Expert 2019

Commented:
Have you checked your References for something missing/broken ?
Mark EdwardsChief Technology Officer
CERTIFIED EXPERT

Commented:
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.
Fabrice LambertConsulting
CERTIFIED EXPERT
Distinguished Expert 2017

Commented:
Make an autoexec macro that run a VBA function that will:
- Check for linked tables.
- Once ok, open the main form.
Bernard ThouinIT Analyst and developer

Author

Commented:
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
IT Analyst and developer
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
Bernard ThouinIT Analyst and developer

Author

Commented:
Thanks for your time, guys.
Mark EdwardsChief Technology Officer
CERTIFIED EXPERT

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

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.