>I dropped 3 command buttons on a form from the toolbar, and
>set the captions to "Hello 1", "Hello 2" and "Hello 3". They
>are named "Command1", "Command2" and "Command3".
>
>Then I ran this code, and MsgBox returned "Hello 3"
>
>
>Private Sub Form_Load()
>
> Dim oButton As CommandButton
>
> Set oButton = Me.Controls(0)
>
> MsgBox oButton.Caption
>
>End Sub
>
>
>
>Why isn't button 1 in element 0?
You mean:
dim oB as CommandButton
for each oB in me.controls
msgbox oB.Caption
next
set oB=Nothing
Igor
Igor Gelin
Database Developer