[AccessD] Nz() etc.

Jim Dettman jimdettman at verizon.net
Tue Sep 25 10:13:45 CDT 2007


 <<What am I doing wrong?>>

  Nothing.  Access in some cases does not return a NULL, but an error.  To
avoid this, use the function below and wrap whatever calculation you are
doing with it.  Note that you can easily add a null to zero check in it as
well.

Jim.

Function AvoidError(n As Variant)
         
    On Error GoTo Trap
    AvoidError = n
    Exit Function

Trap:
    AvoidError = 0
    Resume Next

End Function
-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Arthur Fuller
Sent: Tuesday, September 25, 2007 10:59 AM
To: Access Developers discussion and problem solving
Subject: [AccessD] Nz() etc.

I've got a form that opens when you click a button. Two of the columns are
calculated. They use Nz(parm1, parm2) and I would think that this results in
zeros in both cases when I am adding new rows, but instead they both come up
with #error, which is unbeautiful. What am I doing wrong?

TIA,
Arthur
-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com




More information about the AccessD mailing list