Solved

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

Posted on 2010-09-23
6
354 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
  • 4
  • 2
6 Comments
 
LVL 53

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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

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 53

Expert Comment

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

~bp
0

Featured Post

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

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…
Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

777 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