Unable to SetFocus--receiving Run-time error '2465'

  • Thread starter Thread starter jvpro
  • Start date Start date
J

jvpro

I'm trying to create a Load event procedure that moves the focus to the first
report name in the list box when a form opens. But when I go to the Form view,
it says Run-time error '2465: Microsoft Office Access can't find the field
"|" referred to in your expression.

I put this for the code:

Private Sub Form_Load()
'Move the focus to the list box and
'highlight the first query
[QueryList].SetFocus
SendKeys "{Down}"
End Sub

I'm using Access 2003 and Windows XP Pro. Thanks!
 
The "]" character is not permitted in a control name, so your control name
must be different. Select the listbox in form design view and look at the
caption of the Properties window to see the actual name of the listbox.
 
Back
Top