|
|||||||
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
#1 |
|
Member (10 bit)
|
I know I have done this before when running some tutorial but I can't remember what I'm missing. I'm trying to find the number of records in a table where for a specific rep.
Code:
Dim intRecords
strSQL = "SELECT Count(*) AS intRecords, TicketNumber, Rep"
strSQL = strSQL = " WHERE Rep = " & Request.Form("Rep")
|
|
|
|
|
|
#2 |
|
SQL nutcase
|
I think you want to do something like this.
Code:
strSQL = "SELECT Count(*) AS intRecords, TicketNumber, Rep"
strSQL = strSQL & "FROM tbl"
strSQL = strSQL & " WHERE Rep = " & Request.Form("Rep") & " "
strSQL = strSQL & "GROUP BY TicketNumber, Rep "
|
|
|
|
|
|
#3 |
|
Member (10 bit)
|
Other than being a little neater than mine, is there a difference in the statement?
|
|
|
|
|
|
#4 |
|
SQL nutcase
|
The Group by statement
|
|
|
|
|
|
#5 |
|
Member (10 bit)
|
Perfect, thank you.
You don't know how to set the page to timeout as soon as they submit a form.... so they can't go back and create more than one record? |
|
|
|
|
|
#6 |
|
SQL nutcase
|
Not really. You can execute an ado command asynchronously, but I don't think that gives the desired effect.
|
|
|
|
|
|
#7 | ||
|
Member (10 bit)
|
I tried at vbforums.com and they didn't know either. Not a problem.
I have another question though. I am having some problems writing a page that grabs information from an access database. The page is SUPPOSED to make a table row for each Rep including the Rep's Name and the amount of tickets they've entered withing a time frame. The strSQL looks like this Code:
strSQL = "SELECT Count(*) As intTickets, Opened_By FROM Tickets"
strSQL = strSQL & " WHERE Opened_Date Between #" & Request.form("Date_From") & "# AND #" & Request.Form("Date_To") & "#"
strSQL = strSQL & " GROUP by Opened_By"
Code:
For each Opened_By in ? %> |
||
|
|
|
|
|
#8 |
|
Member (9 bit)
Join Date: Dec 1999
Location: Midland, NC, USA
Posts: 292
|
So, are you executing the SQL string by opening a recordset? Something like:
Set rsTickets = connTicketConn.execute strSQL ? If so, you build a loop: Code:
While not rsTickets.EOF
Response.Write "<TR><TD>" & rsTickets("Opened_By") & _
"</TD><TD>" & rsTickets("intTickets") & "</TD></TR>"
rsTickets.MoveNext
Loop
[Edited by UncaDanno on 01-17-2001 at 10:53 PM] |
|
|
|
|
|
#9 |
|
Member (10 bit)
|
That is exactly what I need to do, but I'm stuck with something I don't think anyone online can help me with. I'm getting an error that says "Object Required" if I put the script into the page. If I put it at the top of the page it works fine. Same strSQL and everything. I don't know what I'm doing wrong, but it has to be within the page somewhere that's stopping it from working.
I'll keep reading into the page and let you know if I have any more problems. Thanks again for your help everyone. |
|
|
|
|
|
#10 |
|
Member (10 bit)
|
I found it. Thanks guys. It was stuck in an include file that I thought would not change what I was doing. Thanks again for your help.
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|