G
gci1000
Having some problem with VBA record set not being set correctly - probably a
bug in the code. Any help would be great. Run-time error. I have the
following code:
Set rs = CurrentDb.OpenRecordset("SELECT Code, LongCaption FROM MyTable")
Do While rs.EOF = False
longDescExists = False
If currentLongDesc = "" Then
' --> Code crashed here when it reaches this point for the 2nd time
Set rs2 = CurrentDb.OpenRecordset("SELECT Code, " & descName & "
FROM " & tblName & " RT Where RT.Code = 'B'")
WhichRs = "rs2"
If rs2.EOF = False Then
longDesc = rs2(1)
If longDesc <> "" Then longDescExists = True
End If
End If
End If
rs.MoveNext
Loop
rs.Close
rs2.Close
bug in the code. Any help would be great. Run-time error. I have the
following code:
Set rs = CurrentDb.OpenRecordset("SELECT Code, LongCaption FROM MyTable")
Do While rs.EOF = False
longDescExists = False
If currentLongDesc = "" Then
' --> Code crashed here when it reaches this point for the 2nd time
Set rs2 = CurrentDb.OpenRecordset("SELECT Code, " & descName & "
FROM " & tblName & " RT Where RT.Code = 'B'")
WhichRs = "rs2"
If rs2.EOF = False Then
longDesc = rs2(1)
If longDesc <> "" Then longDescExists = True
End If
End If
End If
rs.MoveNext
Loop
rs.Close
rs2.Close