473,851 Members | 2,207 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_BeforeUpd ate 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 4313
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.goo gle.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_BeforeUpd ate 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.Se tfocus
DoCmd.Combo1.Dr opDown
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.go ogle.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_BeforeUpd ate 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.go ogle.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_BeforeUpd ate 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
1254
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 However I also want to validate the control so that the user cannot go to the next control without choosing from the list. This I've done with.
0
1833
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 for input to another operation. Originally, I had a drop-down box with the client name and the client id number and it worked fine, but it was for a demo and was quick-and-dirty. For the real app, there are over 1,700 client ids and the...
3
3213
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 just want to add a new item to a combo that has data from a file, by typing in the new value , adding to the file and the requerying to get the new valus in the list. i.e. a data entry and data display combo box. I select an item from cmb1 and...
10
9591
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, not ID's, so I have to convert the ID's from various lookup tables. The combo boxes work fine except for subcategory, which is dependent on category. Depending on category, the drop-down box for subcategory will display different items. (for...
0
2933
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 lot of time trying to figure it out, over the years. It finally dawned on me a couple of weeks ago how to do this. A couple of notes: 1) This is written for a different audience than CDMA; it's written for
13
8650
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 OnGetFocus event of the combo box control, and this appears to work...I'm guessing because one cannot click on the drop down arrow of a combo box control without first having the combo box control receive focus. But I noticed that the code gets...
4
2795
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, seems to always generate an error when I try and refer to the other combo box. I'm aware of the necessity of setting the focus on the second box before referring to it, unless one is using the default value. I'm too tired to type out...
6
2752
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, and hit arrowdown again and enter to select the right value. But I was wondering if somehow I can skip the Alt-ArrowDown-and-enter and just scroll through the list with some keycombination and without the actual dropdown list being visible. ...
0
9896
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9747
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11017
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10352
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9505
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7905
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5736
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5933
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4143
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.