View Single Post
  #10  
Old June 10th, 2006, 04:24 PM posted to microsoft.public.access.queries
external usenet poster
 
Posts: n/a
Default #error results in unmatched records of outer join - Error handlercode

Hi Steve,

Don't give up on UDFs -- you really need more checking than
you can do in an equation. Before you send the value to the
UDF, make sure it is not null. Then, in the UDF, put error
checking in before your calculation so you do not use string
manipulation on null values and use an error handler

ColumnName: IIF(
Isnull([expression]),
0,
ParseWI([expression])
)

I also noticed you used the first (optional) parameter of
Instr -- if it is 1, you do not need to specify that

'~~~~~~~~~~~~~~~~~~~~~~
dim mPos as integer
mPos = Instr(parametername," " )
if mPos 0 then

'~~~~~~~~~~~~~~~~~~~~~~


ERROR HANDLER CODE:

put this at the top of your program
'~~~~~~~~~~~~~~~~~~~~~~

On Error GoTo Proc_Err

'initialize function
FunctionName = 0 'default value

'~~~~~~~~~~~~~~~~~~~~~~

put this at the end of the program

'~~~~~~~~~~~~~~~~~~~~~~

FunctionName = calculated value

Proc_Exit:
On Error Resume Next
'release object variables if any
Exit Function

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

'~~~~~~~~~~~~~~~~~~~~~~



Warm Regards,
Crystal
Microsoft Access MVP 2006

*
Have an awesome day

remote programming and training
strive4peace2006 at yahoo.com

*

Steve wrote:
Actually the field "expression" in the ac_economics table is alway populated.
In my first query I extract the first portion of the string from
"expression" and make it numeric. That step works fine. It's when I try to
combine it back to the master table "ac_property" with an outer join that I'm
getting the #error for records that are in "ac_property" but not in
"ac_economics". I even tried the nz function in the last query where the
outer join is and still get the #error. I tried using a udf to parse out the
value and convert it but still had the same results. Thanks again for your
help.
Steve