I have a code that contains
For X = intNumberOfSlots To 1 Step -1
rsExists.Open "SELECT * FROM Registration WHERE EventID = " & Me!EventID & " and RopingOrder = " & X, CurrentProject.Connection, adOpenStatic, adLockReadOnly
If rsExists.RecordCount = 0 Then
intBestSlotNo = X
rsExists.Close
Exit For
End If
rsExists.Close
Next X
When I run this command button I get a error compile error
variable not defined and it stops at the For X. Can someone help me with this code?
For X = intNumberOfSlots To 1 Step -1
rsExists.Open "SELECT * FROM Registration WHERE EventID = " & Me!EventID & " and RopingOrder = " & X, CurrentProject.Connection, adOpenStatic, adLockReadOnly
If rsExists.RecordCount = 0 Then
intBestSlotNo = X
rsExists.Close
Exit For
End If
rsExists.Close
Next X
When I run this command button I get a error compile error
variable not defined and it stops at the For X. Can someone help me with this code?