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

Do Loop not looping to Next record

Status
Not open for further replies.

JSMITH242B

Programmer
Mar 7, 2003
352
GB
Hi Group,
I have the following code:
On the onload...
updatePermit ("updatePermit")


Function updatePermit(ByVal Action As String)
On Error GoTo Err_updatePermit
Dim objCom As ADODB.Command
Dim objRS As ADODB.Recordset


If objConn.State = adStateOpen Then
Set objCom = New ADODB.Command

With objCom

.CommandText = "xyz"
.CommandType = adCmdStoredProc
.ActiveConnection = objConn.ConnectionString
.Parameters.Append objCom.CreateParameter("RETURN_VALUE", adInteger, adParamReturnValue, 4)
.Parameters.Append objCom.CreateParameter("@function", adVarChar, adParamInput, 30, Action)
.Execute
End With
updatePermit = objCom.Parameters("RETURN_VALUE")

If updatePermit <> 0 Then
Set objRS = objCom.Execute
Do While Not objRS.EOF
strLBHF_ID = objRS.fields("HH_ID")
strreg = Trim(objRS.fields("vehicleReg"))
strClass = Trim(objRS.fields("permitclass"))
strzone = Trim(objRS.fields("permitzone"))
strValid = objRS.fields("validdate")
strexpiry = objRS.fields("expirydate")
strEnabled = objRS.fields("enabled")


ParkUpdate strLBHF_ID, strreg, strClass, strzone, strValid, strexpiry, strEnabled
' The above calls the ParkUpdate Function below.
'When the ParkUpdate Function returns to this calling Function it 'comes in on the line below (Loop) then goes to the strLBHF_ID = objRS.fields("HH_ID") line - as expected, but when I check the value of strLBHF_ID, it is still pointing at the first record and not the next one in the recordset.

Loop

objRS.Close
objConn.Close


End If
End If
Exit_updatePermit:
Exit Function

Err_updatePermit:

Resume Exit_updatePermit
End Function


Function ParkUpdate(LBHFID, VehicleReg, PermitClass, Zone, ValidDate, ExpiryDate, Enabled)

Set srvxmlHttp = CreateObject("Msxml2.ServerXMLHTTP.4.0")
Set xmldoc = CreateObject("Msxml2.DOMDocument")

FormattedValidDate = Format(ValidDate, "ddmmyyyy")
FormattedExpiryDate = Format(ExpiryDate, "ddmmyyyy")

'Connect to a WebService here...

xmldoc.loadXML (srvxmlHttp.responseText)
Dim objCom As ADODB.Command
Set objCom = New ADODB.Command

objCom.ActiveConnection = objConn

If Err.Number <> 0 Then
strResult = Err.Number
strResultDesc = Err.Description


objCom.ActiveConnection = objConn
objCom.CommandText = "pe_logParkmobileErrors"
objCom.CommandType = adCmdStoredProc
objCom.Parameters("@LBHFID") = LBHFID
objCom.Parameters("@ClientID") = 0
objCom.Parameters("@resultCode") = strResult
objCom.Parameters("@resultdescription") = strResultDesc
objCom.Execute
Else
Set objCom = New ADODB.Command
objCom.ActiveConnection = objConn '15/12/2004

objCom.CommandType = adCmdStoredProc
objCom.CommandText = "pe_updParkMobile"
objCom.Parameters("@LBHF_ID") = LBHFID
objCom.Parameters("@action") = "U"

objCom.Execute
Set objCom = Nothing
End If

Set srvxmlHttp = Nothing
Set xmldoc = Nothing
End Function
 
Maybe I am missing something but I do not see a objRS.MoveNext anywhere.
 
where is the .movenext statement for to the next record in the recordset

are am I missing something
 
Oh my gosh!! Thanks guys!!
No excuses but it is not being able to do programming for a number of years in a programming job and I seem to have lost it!!
This bit of code was second nature to me 10 years ago!!


Thanks!!

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top