asp form something like - Not Is Null,

W

Wayne-I-M

Hi

Again may not be possible but is there something on an asp page like the
access formula

Sum ((Nz( IIf (Not [SomeFieldName] Is Null, 1) ) ,0)*123)

This will give a count of the number of time a form field has something in
it (ie. Not Is Null) and time this by 123

So
FieldName = wayne
FieldName = John
FieldName =
FieldName =
FieldName = Mary
=369

Thats 3 fields have something in then times 123

I do have this but can't this work on my form
http://www.folgarida.co.uk/test.htm

but I need it to be MUCG simpler than this - just add up the fields with
something in and times 123

Many thanks
 
S

Stefan B Rusynko

You do that w/ your recordset open sql statement
<%
Conn1_Name = Application("YourGlobalASAName_ConnectionString")
SomeFieldNameCount=0
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open Conn1_Name
strSQL = "SELECT Count(SomeFieldName) AS SomeFieldNameCount FROM TableName WHERE LEN(SomeFieldName)>0"
Set objRS = Server.CreateObject("ADODB.Recordset")
objRS.Open strSQL, Conn1_Name
IF NOT objRS.EOF THEN SomeFieldNameCount=objRS("SomeFieldNameCount")*123
objRS.Close
Set objRS = Nothing
Conn.Close
Set Conn = Nothing
Response.Write SomeFieldNameCount
%>

In ASP/ADO you need to be careful ckecking for empty strings vs Null strings, since they are not the same
- unless you explicitly set all empty fields in your DB as NULL they will be Empty and not be an IsNull

NZ is not supported by ASP but you can create a NZ like function
See http://tutorials.aspfaq.com/8000xxx...function-without-getting-80040e14-errors.html
_____________________________________________
SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
"Warning - Using the F1 Key will not break anything!" (-;
To find the best Newsgroup for FrontPage support see:
http://www.net-sites.com/sitebuilder/newsgroups.asp
_____________________________________________


| Hi
|
| Again may not be possible but is there something on an asp page like the
| access formula
|
| Sum ((Nz( IIf (Not [SomeFieldName] Is Null, 1) ) ,0)*123)
|
| This will give a count of the number of time a form field has something in
| it (ie. Not Is Null) and time this by 123
|
| So
| FieldName = wayne
| FieldName = John
| FieldName =
| FieldName =
| FieldName = Mary
| =369
|
| Thats 3 fields have something in then times 123
|
| I do have this but can't this work on my form
| http://www.folgarida.co.uk/test.htm
|
| but I need it to be MUCG simpler than this - just add up the fields with
| something in and times 123
|
| Many thanks
|
|
|
|
|
| --
| Wayne
| Manchester, England.
|
 
M

Mike Mueller

It is also possible to replace these 2 lines:
Set objRS = Server.CreateObject("ADODB.Recordset")
objRS.Open strSQL, Conn1_Name
with
SET objRS = Conn.Execute(strSQL)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top