Solved

Nz Function and Visual Basic

Posted on 2003-11-14
7
578 Views
Last Modified: 2013-12-25
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
0
Comment
Question by:jayakul
7 Comments
 
LVL 49

Expert Comment

by:Ryan Chong
ID: 9753649
Try:

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

?
0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 9754478
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
0
 
LVL 29

Expert Comment

by:leonstryker
ID: 9764215
Try this:

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

Leon
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:jayakul
ID: 9776777
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.


0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 9779885
Do you need help closing your old open questions.

Anthony
0
 
LVL 1

Expert Comment

by:ayufans
ID: 10512061
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
0
 

Accepted Solution

by:
CetusMOD earned 0 total points
ID: 10544522
PAQed, with points refunded (100)

CetusMOD
Community Support Moderator
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

919 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now