473,505 Members | 14,686 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Combo Box Drop Down without the focus

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
5 4286
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
DoCmd.Combo1.Setfocus
DoCmd.Combo1.DropDown
and so on...
Nov 13 '05 #3
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1243
by: Rob | last post by:
I'm new to access and have a combo box which I want to drop down when it has GotFocus. This works well with the following code. Private Sub Location_GotFocus() SendKeys "%{DOWN}", True End Sub...
0
1805
by: Colleyville Alan | last post by:
I have an app that looks up an id number and when a button is clicked, inputs the id # into a query. After running the query, I click a second button which grabs the client name rather than the id...
3
3189
by: mal | last post by:
Sorry for repost - system added to another subject for some reason Have tried numerous ideas from the group to solve this one. It is such a simple example that it should be straightforward ! I...
10
9533
by: lorirobn | last post by:
Hi, I have a form with several combo boxes, continuous form format, with record source a query off an Item Table. The fields are Category, Subcategory, and Color. I am displaying descriptions,...
0
2914
by: Jeremy Wallace | last post by:
Folks, Here's a write-up I did for our developer wiki. I don't know if the whole rest of the world has already figured out how to do this, but I hadn't ever seen it implemented, and had spent a...
13
8600
by: mirandacascade | last post by:
I want to set things up such that a section of code will have been executed by the time one clicks on the drop down arrow on a combo box control. Currently, that section of code resides in the...
4
2772
by: Gord | last post by:
When clicking an item from a drop down list on a combo box, how does one make another combo box make a selection from it's own list? No matter what event I use for my code in the first combo box,...
6
2731
by: John J. | last post by:
In my combo's list I have for instance these values: AbcdX AbcdY When I press A in the combo, AbcdX gets selected though I need AbcdY to be selected. With Alt-ArrowDown I can dropdown the list,...
0
7098
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7303
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7367
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
5028
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4699
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3176
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1528
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
754
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
407
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.