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

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!
 
B

Brendan Reynolds

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top