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

Help with code

Status
Not open for further replies.

sfrope1

Technical User
May 17, 2003
6
0
0
US
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?
 
Have you declared the X variable at the beginning of your procedure? If you use Option Explicit, then you must declare all of your variables.

You need Dim X as Integer (or Long depending on how big the number is.)
 
Thank you, that made it work great
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top