Solved

Don't Load/Show Null or 0 value in recordset

Posted on 2010-09-23
6
369 Views
Last Modified: 2013-12-25
For:
ASP Classic / MS Access Database

This is what I have now when I load the database:
Recordset1.Source = "SELECT * FROM Detail WHERE CardNum='1621706607' AND AdvALREADY_CHRGED='1'"

Now when I run that I get alot of returns in a record named: "AdvAmt" that show up as 0's". I don't want them to show up at all.

I know this is wrong but something like this:
Recordset1.Source = "SELECT * FROM Detail WHERE CardNum='1621706607' AND AdvALREADY_CHRGED='1' AND IF NOT AdvAmt='0' " // Like AdvAmt=!'0' "

Thanks for any help....
0
Comment
Question by:CompCobalt
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
6 Comments
 
LVL 54

Accepted Solution

by:
Bill Prew earned 350 total points
ID: 33747533
Not sure exactly what you are after, but is it something like this?  If not, then can you share the layout of the Detail table.

Recordset1.Source = "SELECT * FROM Detail WHERE CardNum='1621706607' AND AdvALREADY_CHRGED='1' AND AdvAmt<>'0' "

this assumes AdvAmt is a character column, not numeric.  If numeric then typicall would be:

Recordset1.Source = "SELECT * FROM Detail WHERE CardNum='1621706607' AND AdvALREADY_CHRGED='1' AND AdvAmt<>0"

lastly, if there are nulls as well as zeroes in that column, then perhaps something like this:

Recordset1.Source = "SELECT * FROM Detail WHERE CardNum='1621706607' AND AdvALREADY_CHRGED='1' AND AdvAmt<>'0' AND advAmt IS NOT NULL"

~bp
0
 

Author Comment

by:CompCobalt
ID: 33747691
That did it! Thanks!
0
 

Author Comment

by:CompCobalt
ID: 33747765
How on to question number too...
I added:
Recordset1.Source = "SELECT * FROM Detail WHERE CardNum='1621706607' AND AdvALREADY_CHRGED='1' AND AdvAmt<>0"

And it works, now if the page is empty and no records are found. how do i redirect them to a diffrent page ??? Do u want me to open a new question ?
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:CompCobalt
ID: 33747800
Nevermind i got it, here is the code:


<%
If (Recordset1.RecordCount > 0) Then
    Response.Write("Record(s) are in the RecordSet")
Else
    //Response.Write("RecordSet in empty")
 		Response.Redirect("norecords.asp")
End If
%>

Open in new window

0
 

Author Comment

by:CompCobalt
ID: 33747830
Sorry remove the //Response.Write("RecordSet in empty")
and change it to 'Response.Write("RecordSet in empty")
It's a comment... :-)
0
 
LVL 54

Expert Comment

by:Bill Prew
ID: 33747965
Okay, glad my original response was helpful.  Thanks.

~bp
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
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…

710 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