Go Back   PCMech Forums > Help & Discussion > Web Design / Development

Need Some Help? Type Your Keywords Here:

Reply
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Old 01-16-2001, 01:04 PM   #1
Member (10 bit)
 
Join Date: May 1999
Location: Orlando, FL
Posts: 975
Send a message via ICQ to artsapimp
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")
Thanks
artsapimp is offline   Reply With Quote
Old 01-16-2001, 02:01 PM   #2
SQL nutcase
 
mosquito's Avatar
 
Join Date: Sep 2000
Location: Belgium
Posts: 1,136
Send a message via AIM to mosquito
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 "
mosquito is offline   Reply With Quote
Old 01-16-2001, 02:18 PM   #3
Member (10 bit)
 
Join Date: May 1999
Location: Orlando, FL
Posts: 975
Send a message via ICQ to artsapimp
Other than being a little neater than mine, is there a difference in the statement?
artsapimp is offline   Reply With Quote
Old 01-16-2001, 02:30 PM   #4
SQL nutcase
 
mosquito's Avatar
 
Join Date: Sep 2000
Location: Belgium
Posts: 1,136
Send a message via AIM to mosquito
The Group by statement
mosquito is offline   Reply With Quote
Old 01-16-2001, 03:08 PM   #5
Member (10 bit)
 
Join Date: May 1999
Location: Orlando, FL
Posts: 975
Send a message via ICQ to artsapimp
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?
artsapimp is offline   Reply With Quote
Old 01-16-2001, 03:30 PM   #6
SQL nutcase
 
mosquito's Avatar
 
Join Date: Sep 2000
Location: Belgium
Posts: 1,136
Send a message via AIM to mosquito
Not really. You can execute an ado command asynchronously, but I don't think that gives the desired effect.
mosquito is offline   Reply With Quote
<% Next ...Thanks for any help you can offer.
Old 01-17-2001, 02:24 PM   #7
Member (10 bit)
 
Join Date: May 1999
Location: Orlando, FL
Posts: 975
Send a message via ICQ to artsapimp
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"
I am having a problem with the FOR EACH loop.

Code:
For each Opened_By in ?
%>
<%= rst("Opened_By")%> <%= rst("intTickets")%>
artsapimp is offline   Reply With Quote
Old 01-17-2001, 09:50 PM   #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>" &amp rsTickets("intTickets") &amp "</TD></TR>"
    rsTickets.MoveNext
Loop
Or am I way out in left field?


[Edited by UncaDanno on 01-17-2001 at 10:53 PM]
UncaDanno is offline   Reply With Quote
Old 01-22-2001, 11:20 AM   #9
Member (10 bit)
 
Join Date: May 1999
Location: Orlando, FL
Posts: 975
Send a message via ICQ to artsapimp
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.
artsapimp is offline   Reply With Quote
Old 01-22-2001, 11:24 AM   #10
Member (10 bit)
 
Join Date: May 1999
Location: Orlando, FL
Posts: 975
Send a message via ICQ to artsapimp
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.
artsapimp is offline   Reply With Quote
Reply

Bookmarks

Still Need Help? Type Your Keywords Here:


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 07:34 AM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
SEO by vBSEO 3.6.0 PL2