By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,635 Members | 911 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,635 IT Pros & Developers. It's quick & easy.

Combo Box Drop Down without the focus

P: n/a
I have read the posts on using Sendkeys to dropdown the list in a
combo box. However, doesn't that require the combo box to have the
focus?

My situation is a little different. I have a text box and on the
BeforeUpdate of that text box I check a value. If the value > 0, then
the text box is OK and the program can continue. If the value = 0 or
null, I want a combo box to drop down.

For simplicity here are the control names:
-----------------------------------------
Text1 ---> My text box
Text2 ---> must be greater than zero
Combo1 ---> The combo box I want to drop down.

Access will not let me do Combo1.DropDown while still in the
Text1_BeforeUpdate event. It will also not let me do Combo1.Setfocus.

So I thought of using the SendMessage API call to send a dropdown
message to the combo box. Will that work? Any other suggestions?
Nov 13 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
My understanding is that Access controls aren't real windows until they
receive the focus.
And so surely the combo box couldn't drop down until that is true - so
sending an API message included any which way you look at it will always
require the focus.

Couldn't something similar be achieved with a list box - possibly not
visible until this criteria of yours is met?

hth

--
---------------------------------------------------------------
"Paul" <pw****@hotmail.com> wrote in message
news:b8**************************@posting.google.c om...
I have read the posts on using Sendkeys to dropdown the list in a
combo box. However, doesn't that require the combo box to have the
focus?

My situation is a little different. I have a text box and on the
BeforeUpdate of that text box I check a value. If the value > 0, then
the text box is OK and the program can continue. If the value = 0 or
null, I want a combo box to drop down.

For simplicity here are the control names:
-----------------------------------------
Text1 ---> My text box
Text2 ---> must be greater than zero
Combo1 ---> The combo box I want to drop down.

Access will not let me do Combo1.DropDown while still in the
Text1_BeforeUpdate event. It will also not let me do Combo1.Setfocus.

So I thought of using the SendMessage API call to send a dropdown
message to the combo box. Will that work? Any other suggestions?



Nov 13 '05 #2

P: n/a
DoCmd.Combo1.Setfocus
DoCmd.Combo1.DropDown
and so on...
Nov 13 '05 #3

P: n/a
Geir, I tried what you posted, but it didn't work. I get the error message:

"Method or data member not found"

It highlights the ".Combo1" code.

Any other suggestions?
Nov 13 '05 #4

P: n/a
pw****@hotmail.com (Paul) wrote in message news:<b8**************************@posting.google. com>...
I have read the posts on using Sendkeys to dropdown the list in a
combo box. However, doesn't that require the combo box to have the
focus?

My situation is a little different. I have a text box and on the
BeforeUpdate of that text box I check a value. If the value > 0, then
the text box is OK and the program can continue. If the value = 0 or
null, I want a combo box to drop down.

For simplicity here are the control names:
-----------------------------------------
Text1 ---> My text box
Text2 ---> must be greater than zero
Combo1 ---> The combo box I want to drop down.

Access will not let me do Combo1.DropDown while still in the
Text1_BeforeUpdate event. It will also not let me do Combo1.Setfocus.

So I thought of using the SendMessage API call to send a dropdown
message to the combo box. Will that work? Any other suggestions?


I'm thinking perhaps you should use the AfterUpdate event rather than
the BeforeUpdate, or perhaps the BeforeUpdate event of the form itself
rather than of Text1. The BeforeUpdate event of the form itself is
generally more appropriate when you are trying to validate your data
based on multiple controls.

Bruce
Nov 13 '05 #5

P: n/a
pw****@hotmail.com (Paul) wrote in message news:<b8**************************@posting.google. com>...
I have read the posts on using Sendkeys to dropdown the list in a
combo box. However, doesn't that require the combo box to have the
focus?

My situation is a little different. I have a text box and on the
BeforeUpdate of that text box I check a value. If the value > 0, then
the text box is OK and the program can continue. If the value = 0 or
null, I want a combo box to drop down.

For simplicity here are the control names:
-----------------------------------------
Text1 ---> My text box
Text2 ---> must be greater than zero
Combo1 ---> The combo box I want to drop down.

Access will not let me do Combo1.DropDown while still in the
Text1_BeforeUpdate event. It will also not let me do Combo1.Setfocus.

So I thought of using the SendMessage API call to send a dropdown
message to the combo box. Will that work? Any other suggestions?

I'm thinking perhaps you should use the AfterUpdate event rather than
the BeforeUpdate, or perhaps the BeforeUpdate event of the form itself
rather than of Text1. The BeforeUpdate event of the form itself is
generally more appropriate when you are trying to validate your data
based on multiple controls.

Bruce
Nov 13 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.