control names, error handling
---
Hi Bob,
looks like it will work
I would suggest, however, before you write code for controls that you
give them a non-ambiguous name
Command17 must be the Name property of your command button control. A
better Name would be something like cmdSpellingPrintReport
~~~
also, on error handling:
put this at the top of your program, right after the procedure
declaration (skip a line first for better readability)
'~~~~~~~~~~~~~~~~~~~~~~
'set up Error Handler
On Error GoTo Proc_Err
'~~~~~~~~~~~~~~~~~~~~~~
... then your statements
'~~~~~~~~~~~~~~~~~~~~~~
put this at the end of the program
'~~~~~~~~~~~~~~~~~~~~~~
Proc_Exit:
On Error Resume Next
'release object variables if any
Exit Function 'or Exit Sub
Proc_Err:
MsgBox Err.Description, , _
"ERROR " & Err.Number _
& " ProcedureName"
'press F8 to step through code and debug
'remove next line after debugged
Stop: Resume
Resume Proc_Exit
'~~~~~~~~~~~~~~~~~~~~~~
where
ProcedureName is the name of your procedure so you can identify what
code the problem is in when you see the error
While I am developing, I like to make the error handler go to the line
that caused the problem so I can see where it is. Stop will stop the
code and Resume goes back to the offending line. When code Stops, press
F8 to execute one statement at a time.
The line labels do not matter (Proc_Exit:, Proc_Err
, I like to use the
same ones all the time -- they only have to be unique within a procedure.
Warm Regards,
Crystal
*
have an awesome day
*
MVP Access
Remote Programming and Training
strive4peace2006 at yahoo.com
*