Access 2007 Load event procedure

J

jastic

I have a form which is a list of queries and I want to create a load event
that will place the focus on the first query in the list box automatically.
It seems simple, but I keep getting an error:

Private Sub Form_Load()
'Move the focus to the list box and then to the first query in the list
lstQueryList.SetFocus
SendKeys "{Down}"
End Sub

My error is shows to be in "lstQueryList.SetFocus" Any suggestions?
Thanks for any replies!
 
S

Stuart McCall

jastic said:
I have a form which is a list of queries and I want to create a load event
that will place the focus on the first query in the list box
automatically.
It seems simple, but I keep getting an error:

Private Sub Form_Load()
'Move the focus to the list box and then to the first query in the
list
lstQueryList.SetFocus
SendKeys "{Down}"
End Sub

My error is shows to be in "lstQueryList.SetFocus" Any suggestions?
Thanks for any replies!

Me.ListboxName = Me.ListboxName.ItemData(0)
 
Top