Link to home
Start Free TrialLog in
Avatar of jayakul
jayakul

asked on

Nz Function and Visual Basic

I'm using Nz function in Access-2000 query without any problem.
But what i want is to use Nz function directly through recordset in Visual Basic. I don't want to use Access Query due to some reasons. I'm using VB-6.0 and ADO. But in this case it's giving me error unrecognized Nz Function. Following is the snippet that i'm using:

dim rs as New ADODB.recordset
rs.open "select Nz(Sum(qty),0) From Tab1 Where Sno = 5",cn,.....

It's giving error in this statement. What could be the problem. Please help......

thanx and regards,
jigyasa
Avatar of Ryan Chong
Ryan Chong
Flag of Singapore image

Try:

Select Sum(Qty) From Tab1 Where Qty is Not NULL

?
Please maintain your old open questions:

1 02/04/2003 300 access to shared folders through vb appl...  Open Windows NT Networking
2 09/16/2003 250 Import MS-Access-2000 Data to SQL Server...  Open VB Databases
3 10/02/2003 50 File Field Control  Open JavaScript
4 10/02/2003 150 Multiple Columns With Restricted Detail ...  Open Crystal Reports

Thanks,
Anthony
Try this:

Select Sum(Qty) From Tab1 Where Qty Is Not NULL AND Sno = 5

Leon
Avatar of jayakul
jayakul

ASKER

i've got the solution. The code i've written in the question is just a snippet, I can not use these simple Select Queries with check for Null. I need to have something sort of Nz function only. Following Statement can be used in place of Nz function, becoz Nz can not be used from VB. this i got from some other site....

IIf(IsNull(Sum(Qty)), 0, Sum(Qty))

This works fine. thanx for the sincere efforts. i'm closing this question now.


Do you need help closing your old open questions.

Anthony
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

- PAQ'd and points refunded

Please leave any comments here within the next four days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER !

ayufans
Cleanup Volunteer
ASKER CERTIFIED SOLUTION
Avatar of CetusMOD
CetusMOD
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial