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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Recordset starting with a middle record - not the first 1

Status
Not open for further replies.

SlakeB

MIS
Jun 15, 2005
40
US
I am having a problem with my recordset starting with a middle record instead of the first record. I'm trying to go through each record in the recordset to get values for a few arrays in my vbscript code. My DB table has the following form:

BS_STP_NUM | LAT | LON

1 | -84 | 39
2 | -85 | 40
. . .
. . .
. . .


Here is my vbscript code

Code:
sSQL3 = "SELECT * FROM BUS_STOP"

Set objRS2 = Nothing
Set objRS2 = CreateObject("ADODB.Recordset")
	objRS2.Open sSQL3, db

counter = 0

objRS2.MoveFirst
Do While Not objRS2.EOF
	counter = counter + 1
		
	stopNum(counter) = objRS2("BS_STP_NUM")
	stopLat(counter) = objRS2("LAT")
	stopLon(counter) = objRS2("LON")
		
	objRS2.MoveNext
Loop
objRS2.close
Set objRS2 = Nothing

I put the "MoveFirst" command in before the "Do While", but it didn't seem to solve the problem.

Some sample output I'm getting:
stopNum(1) = 5 <--(this should be 1, not 5)


Please Help!
 
Have you tried this ?
sSQL3 = "SELECT * FROM BUS_STOP ORDER BY BS_STP_NUM"

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top