Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2010-09-23
6
Medium Priority
?
377 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 59

Accepted Solution

by:
Bill Prew earned 1400 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

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 59

Expert Comment

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

~bp
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone 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

Not long ago I saw a question in the VB Script forum that I thought would not take much time. You can read that question (Question ID  (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_28455246.html)28455246) Here (http…
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…
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…
Suggested Courses

885 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