Solved

Nz Function and Visual Basic

Posted on 2003-11-14
7
575 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
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 

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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
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…

747 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

12 Experts available now in Live!

Get 1:1 Help Now