NZ function?

message from js on 27 May 2004
Hello,

I can use a NZ function query in a VBA code, but got error when I using ADO
Dim cnn As New ADODB.Connection
Dim rs As New ADODB.Recordset
cnn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=..."
cnn.Open
rs.Open "select NZ(field1,0) from tb1", cnn
rs.Close
cnn.Close

Error: Underfined function 'NZ' in expression?

How to fix it? Thanks..
 
MyndPhlyp replied to js on 27 May 2004
How about:

SELECT IsNull(field1, 0) FROM tbl
 
js replied to MyndPhlyp on 27 May 2004
Thanks for the help.
Then run-time error: -2147217900(80040e14)
Wrong number of arguments used with function in query expression (xxx).

"MyndPhlyp" <nobody@home.now> wrote in message
news:Ow5%23ij$QEHA.2976@TK2MSFTNGP10.phx.gbl...
 
Brian Kastel replied to js on 27 May 2004
Should be: SELECT IIf(IsNull(field1), 0, field1) FROM tbl

Syntax: IIf(testvar, truepart, falsepart)
 
js replied to Brian Kastel on 27 May 2004
Thanks Brian,
Why I can't use NZ in a query?

in message news:Rtntc.31609$Ol3.26369@twister.tampabay.rr.com...
 
Douglas J. Steele replied to js on 27 May 2004
Nz is a VBA function. ADO doesn't know anything about VBA and its functions.
 
Brian Kastel replied to js on 27 May 2004
That's a separate issue that I don't know the answer to since I don't use
ADO (not from an particular position, but just because I've never had a
reason to). If that worked, then it's just a workaround for you until you
can get the core issue resolved.
 

Archived message: NZ function? (MS Access Database)