Solved

When an error occurs on form load, how do I resume opening after fixing the error?

Posted on 2006-11-14
6
186 Views
Last Modified: 2012-06-21
When my form loads, it does some tLookups to retrieve settings. If the database is missing, renamed, etc., an error occurs. At this point I let the user reconnect to the database. Now I want to resume loading the form again, but it stays stalled wherever the error occurred.  If the error occurred on the open event I could do cancel = true, but that isn't where the error occurrs.  In fact, it doesn't appear to really occur in any procedure so I had to trap on the form's error event.

I've tried to close the form by using a function to close it before reconnecting the tables, but it crashes Access.

The Errors that trigger this relinking action are:
3024, 3043, 3044, 3151, 3146, 3078


0
Comment
Question by:HKComputer
6 Comments
 
LVL 65

Expert Comment

by:rockiroads
ID: 17938719
Have u tried issuing

Resume Next

or create a label and perform a Goto to that label when u capture the error?
0
 
LVL 4

Author Comment

by:HKComputer
ID: 17938826
I tried resume next and it didn't work.

I didn't try the label but I did try sending it back to Form_Load.


I think I may have found a solution now. I'm starting a different form first that is not bound to any of my backend databases. It then performs some tLookups to the backends. If errors occur, everything get's reconnected and then my main form comes up.

The problem is that starting a form bound to a non-existant database makes an "almost" untrappable error occur sometime while the form is opening. And worse yet, it stops all execution of the forms code and you cannot restart it. And as if that isn't bad enough, none of your error handling procedures are allowed to close this form and reopen it because this form called the error procedure, so technically, it is still in the middle of code execution when you try to close it. And that crashes Access.

Oh, the things you learn.
0
 
LVL 4

Author Comment

by:HKComputer
ID: 18229978
Please close and refund. The solution I listed above worked for me. Thanks -HK
0
 
LVL 61

Expert Comment

by:mbizup
ID: 18229995
Got it, HK :-) ... that's what the PAQ-refund recommendation means.  Please take a look at your other open questions.

Thanks in advance,

mbizup
EE Cleanup Volunteer
0
 
LVL 1

Accepted Solution

by:
Computer101 earned 0 total points
ID: 18260690
PAQed with points refunded (500)

Computer101
EE Admin
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Today's users almost expect this to happen in all search boxes. After all, if their favourite search engine juggles with tens of thousand keywords while they type, and suggests matching phrases on the fly, why shouldn't they expect the same from you…
In Debugging – Part 1, you learned the basics of the debugging process. You learned how to avoid bugs, as well as how to utilize the Immediate window in the debugging process. This article takes things to the next level by showing you how you can us…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now