Click to See Complete Forum and Search --> : Error number 5


jborges
March 25th, 2001, 05:46 PM
Do anybody knows why this generates a #5 error??
Private Sub Form_Load()
Me.Text1.SetFocus
End Sub


Julio Borges
Rio de Janeiro - Brazil
jborges@brhs.com.br

phil m
March 25th, 2001, 08:32 PM
Private Sub Form_Activate()
Command1(1).SetFocus 'will work
End Sub

Private Sub Form_Load()
Command1(1).SetFocus ' will not work
End Sub

I think setfocus is not the stuff of load events. Activate, which fires automatically after the laod event, does like setfocus though.

Phil

shree
March 25th, 2001, 09:07 PM
If you want it in the load event, then you must place a Me.Show before calling Text1.Setfocus.

jborges
March 26th, 2001, 06:42 AM
Thanks a lot. It worked fine.

Julio Borges
Rio de Janeiro - Brazil
jborges@brhs.com.br