keyboard in vb

  • Thread starter Thread starter Ulcom
  • Start date Start date
U

Ulcom

Hi

I have a single form containing 5 fields and one of the fields is a combo
box

When you have a record containing one field that is obligatory, if you omit
to fill the field, when you want to leave or try to save, a message pop up
saying that there is a field that you should fill.

What I want is instead of the message by window, i will write a routine on a
button that will open the combobox (it is the obligatory field).
So when the user click the button to leave, if the combobox is blank, it
opens itself (same as if you press ALT + CTRL+Arrow Down)

And the question is
How can I open a combo box with code ?same as pressing CTRL-ALT-Arrow Down

DoCmd.gotocontrrol "nameofthecombobox"
...........................

Thanks
 
Ulcom said:
Hi

I have a single form containing 5 fields and one of the fields is a
combo box

When you have a record containing one field that is obligatory, if
you omit to fill the field, when you want to leave or try to save, a
message pop up saying that there is a field that you should fill.

What I want is instead of the message by window, i will write a
routine on a button that will open the combobox (it is the obligatory
field).
So when the user click the button to leave, if the combobox is blank,
it opens itself (same as if you press ALT + CTRL+Arrow Down)

And the question is
How can I open a combo box with code ?same as pressing
CTRL-ALT-Arrow Down

DoCmd.gotocontrrol "nameofthecombobox"
..........................

The combo box has a DropDown method. Try:

With Me!NameOfTheComboBox
.SetFocus
.DropDown
End With
 
Take a look at the DropDown Method of the combobox:

me.MyCombo.Dropdown

FWIW, I would avoid using docmd.gotocontrol and instead use the Setfocus
method of the control:

me.MyCombo.Setfocus
 
Back
Top