?
Solved

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

Posted on 2006-11-14
6
Medium Priority
?
198 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
5 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
Instead of error trapping or hard-coding for non-updateable fields when using QODBC, let VBA automatically disable them when forms open. This way, users can view but not change the data. Part 1 explained how to use schema tables to do this. Part 2 h…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

749 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