Hi,
I have a error in my code when I run it. In the following code, if the where statement doesn't return anything I get an error.
Here's the code:
while not objRecordSet.EOF
strSQL = "SELECT bhagnb FROM mvxjdta.staghe WHERE bhagnb = ('" & objRecordSet(0) &"'))"
objRS = objConnection.Execute(strSQL)
MsgBox objRecordSet(0), vbOKOnly, "1st"
MsgBox objRS(0), vbOKOnly, "2nd"
if (objRecordSet(0) = objRS(0) )Then
intRecordSet = objRS.Count
MsgBox intRecordSet, vbOKOnly, "Count Record"
End If
objRecordSet.MoveNext
Wend
The error occurs at 'MsgBox objRS(0), vbOKOnly, "2nd" ' and at 'if (objRecordSet(0) = objRS(0) )Then ' lines. What I want to do is, if the select statement doesn't bring back anything then I want to output a message (this is not in the above code)
Please help, this is a problem I have had for a while now.
Thanks.
I have a error in my code when I run it. In the following code, if the where statement doesn't return anything I get an error.
Here's the code:
while not objRecordSet.EOF
strSQL = "SELECT bhagnb FROM mvxjdta.staghe WHERE bhagnb = ('" & objRecordSet(0) &"'))"
objRS = objConnection.Execute(strSQL)
MsgBox objRecordSet(0), vbOKOnly, "1st"
MsgBox objRS(0), vbOKOnly, "2nd"
if (objRecordSet(0) = objRS(0) )Then
intRecordSet = objRS.Count
MsgBox intRecordSet, vbOKOnly, "Count Record"
End If
objRecordSet.MoveNext
Wend
The error occurs at 'MsgBox objRS(0), vbOKOnly, "2nd" ' and at 'if (objRecordSet(0) = objRS(0) )Then ' lines. What I want to do is, if the select statement doesn't bring back anything then I want to output a message (this is not in the above code)
Please help, this is a problem I have had for a while now.
Thanks.