Hi everyone ...
I am dynamically adding Option buttons based on the result of a database query, and I am ending up with 1 extra control and it is the first record again :confused:
Here is the important code....

Edit: The RecordCount is correct ..(6) but I end up with 7 option buttons
I have tried
Do ..
Loop Until
Do Until
Do While
Do While NOT ....

Any ideas ?
Thanks,
Michael

Dennis DVR

01-02-2004, 10:19 PM

try this.

Do Until MyRS.EOF
strName = MyRS.Fields.Item("CompanyName").Value

Option1(i).Caption = strName
With Option1(i)
If i > 0 Then
.Top = Option1(i-1).Top + Option1(i-1).Height + 10
.Left = Option1(i-1).Left
End If
.Visible = True
.Value = False
End With
i = i + 1
MyRS.MoveNext
If Not MyRS.EOF Then
Load Option1(i)
End If
Loop