Runtime error when i open a form (1 Viewer)

rick roberts

Registered User.
Local time
Today, 14:12
Joined
Jan 22, 2003
Messages
160
i have a main form with a button that opens a simple form of 2 columns. this all works fine as an .mdb file but when i create an installer package to use with access runtime i have a problem - when i open the second form it shows on the screen but has a runtime error and when the error box is clicked the program shuts down
im using office 2010
thanks in anticipation
 

vbaInet

AWF VIP
Local time
Today, 14:12
Joined
Jan 22, 2010
Messages
26,374
You must have error handlers in all your functions/subs for your packaged solution to work nicely. And remember to Debug > Compile and Compact & Repair afterwards too.
 

rick roberts

Registered User.
Local time
Today, 14:12
Joined
Jan 22, 2003
Messages
160
i did wonder afterwards if that was my problem - i found it happens on two other buttons that print reports
i guess its a little scraPPY of me not to be using error catches
thanks for the reply ill get on it right away
 

rick roberts

Registered User.
Local time
Today, 14:12
Joined
Jan 22, 2003
Messages
160
well i tried Resume Next thinking that this would override the error but it doesnt seem to work
 

vbaInet

AWF VIP
Local time
Today, 14:12
Joined
Jan 22, 2010
Messages
26,374
Resume Next doesn't clear the error. Proper error handling should be enforced.
 

rick roberts

Registered User.
Local time
Today, 14:12
Joined
Jan 22, 2003
Messages
160
that seems a bit difficult when i dont know the actual cause of the error
 

vbaInet

AWF VIP
Local time
Today, 14:12
Joined
Jan 22, 2010
Messages
26,374
Well, you can't really predicate all scenarios so to be safe (and to ensure that your clients don't get annoyed when it unexpectedly crashes), error handle all functions/subs. Yea, I know it's a tough job.

Just make it a habit to put error handlers everytime you create a function/sub.
 

rick roberts

Registered User.
Local time
Today, 14:12
Joined
Jan 22, 2003
Messages
160
im not that usedc to error handling and find it ard to predict what the error might be - if the routines work ok without errors how do i predict what might go wrong?
 

vbaInet

AWF VIP
Local time
Today, 14:12
Joined
Jan 22, 2010
Messages
26,374
There's only so much you can predict with lots and lots of testing. The links I provided provide more than enough information on error handling.
 

vbaInet

AWF VIP
Local time
Today, 14:12
Joined
Jan 22, 2010
Messages
26,374
I hope you hard at work adding those error handling code lines ;)
 

vbaInet

AWF VIP
Local time
Today, 14:12
Joined
Jan 22, 2010
Messages
26,374
You don't know what error handlers are or you don't know which functions/subs to apply them on?
 

rick roberts

Registered User.
Local time
Today, 14:12
Joined
Jan 22, 2003
Messages
160
i understand what error handlers should do but not too familliar - i would suppose that before you can overcome an error you first have to ascertain what the error might be?
 

spikepl

Eledittingent Beliped
Local time
Today, 15:12
Joined
Nov 3, 2010
Messages
6,142
And how do you accomplish that then? By inserting an error handler that shows you what the error number and text is, as per the links provided to you earlier. After you know what the known errors are, then you can handle those, and sweep all else under a CASE ELSE, with some appropriate text shown to the user.

Code:
MsgBox "An unknown error - please grab your children and coworkers and run before the application explodes. You have 10 seconds", vbCritical

alternatively:

Code:
MsgBox Err.Number & Err.Description
 
Last edited:

rick roberts

Registered User.
Local time
Today, 14:12
Joined
Jan 22, 2003
Messages
160
i already tried this -
PROC_ERR:
MsgBox "Error: (" & Err.Number & ") " & Err.Description, vbCritical
but even in the runtime version it gives -
Error(0)
which i presume no error?
 

spikepl

Eledittingent Beliped
Local time
Today, 15:12
Joined
Nov 3, 2010
Messages
6,142
Paste the entire subroutine, that contains the error handler.
 

Users who are viewing this thread

Top Bottom