Solved

Nz Function and Visual Basic

Posted on 2003-11-14
7
594 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 51

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
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 

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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
VBA error replacing data 6 40
TT Auto Dashboard 13 95
I need help embedding an image as HTML in my vb.net application 3 73
VBA: Insert New column with specific format type 12 39
I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

828 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