I numbered my buttons btn_1 btn_2 ect.
I was wondering how to loop through them using a for loop.
i have tried the below but keep getting errors:
Private Sub Form_Open(Cancel As Integer)
Dim rst As ADODB.Recordset
Dim ID As Integer
Dim big As Field
' Dim endoffile As Integer
' Dim x As Integer
' On Error GoTo HandleErrors
Set rst = New ADODB.Recordset
rst.Open "main", CurrentProject.Connection, adOpenKeyset, options:=adCmdTableDirect
' rst.MoveLast
' endoffile = rst.RecordCount - 1
' rst.MoveFirst
For ID = 1 To 3
big.name.Value = "btn_" & ID
Form_Form1!big.Caption = rst.Fields("name")
Next
rst.Close
Set rst = Nothing
End Sub
as you can see my syntax needs work. I need to concatonate the btn_ and the ID to bring up each button.
Any help will be greatly appreciated.
Thanks Lewie
I was wondering how to loop through them using a for loop.
i have tried the below but keep getting errors:
Private Sub Form_Open(Cancel As Integer)
Dim rst As ADODB.Recordset
Dim ID As Integer
Dim big As Field
' Dim endoffile As Integer
' Dim x As Integer
' On Error GoTo HandleErrors
Set rst = New ADODB.Recordset
rst.Open "main", CurrentProject.Connection, adOpenKeyset, options:=adCmdTableDirect
' rst.MoveLast
' endoffile = rst.RecordCount - 1
' rst.MoveFirst
For ID = 1 To 3
big.name.Value = "btn_" & ID
Form_Form1!big.Caption = rst.Fields("name")
Next
rst.Close
Set rst = Nothing
End Sub
as you can see my syntax needs work. I need to concatonate the btn_ and the ID to bring up each button.
Any help will be greatly appreciated.
Thanks Lewie