Setting cursor postion on a form and YesNo box

R

Russ

Access 2000.mdb VBA questions:
When I open a form (OnOpen event procedure), I'd like the cursor
automatically placed over a combobox select button. Is there a vba
command to place the cursor when the form opens? SetFocus only moves
to the fields, not the select buttons.

Also in a YesNo message box, is there a way to have the cursor already
placed over the Yes or No button when it pops up?
 
F

Fred Boer

Dear Russ:

1. Well, you could just set the tab order so that the combobox is the first
in the tab order; that would set the focus to the combobox on opening the
form. You can also set the focus to the combobox with "Me.cboBox.setfocus".
But I wonder if what you really want is to have the combobox "dropped down"?
Is that what you mean by "combobox select button"? That can be done with
"Me.cbobox.dropdown"

2. Add the constant vbDefaultButton2.. for example:

MsgBox("Do you really, really want to do this?", vbYesNo + vbDefaultButton2,
"Are you sure?")

HTH
Fred Boer
 

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