Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need help with Count(*) Statement

Status
Not open for further replies.

dlcook

MIS
Nov 1, 2001
12
US
Can someone help me get this right? I'm trying to count the number of records in a SELECT but I'm doing something wrong - the result is just "". TIA! - David Cook

If Rally = "Russia" Then

SQLStmtC = "SELECT Count(*) As Cnt FROM stimes2 WHERE Name = '" & Name & "' AND Model = '" & Model & "' AND Rally = '" & Rally & "' GROUP BY Name, Model, Rally "
Set RS = Connection.Execute(SQLStmtC)

If Cnt = "" Then
Response.Write "TEST"
End If

If Cnt = 8 Then
Rtime = "SELECT * from stimes2 WHERE Name = '" & Name & "' AND Model = '" & Model & "' AND Rally = '" & Rally & "' GROUP BY Name, Model, Rally"

SQLStmtD = "Insert Into rtimes (Rtime) "
SQLStmtD = SQLStmtD & "VALUES ('" & Rtime & "') WHERE Name = '" & Name & "' AND Model = '" & Model & "' AND Rally = '" & Rally & "'"
' Set RS = Connection.Execute(SQLStmtD)

End If
End If
 
You should compare with RS("Cnt") instead of just Cnt.

For example:
If Cnt = "" Then

should replace with
If Rs("Cnt") = "" Then
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top