473,659 Members | 2,934 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 4300
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
1248
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
1816
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
3202
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
9554
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
2921
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
8626
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
2787
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
2740
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
8427
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
8332
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
8746
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8525
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8627
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
5649
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2750
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 we have to send another system
2
1975
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1737
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.