473,623 Members | 2,453 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How can you use down arrow key to scroll in a drop box?

269 Contributor
I have a QTY field and an ITEM field. User inputs a number into the QTY field, then tabs over the the next field and there's a down arrow on the right hand side of the field that you click to choose the correct item from the drop box. The combination of the QTY and the ITEM is the primary key (two primary keys). When I tab over to the ITEM field and press the down arrow, a message box pops up telling me that a primary key field can't be null (I suppose it's trying to go down to the next box rather than going through the drop down items). Is there an easy fix for this? I want to hit TAB key, DOWN KEY (multiple times to get through the drop box), TAB key (to get to the next QTY field). Thanks!!

Missed you Bytes friends. Implementing the new DB...will be back in January with my next one. :-)
Dec 9 '09 #1
14 6032
Delerna
1,134 Recognized Expert Top Contributor
Hmm .... I think you might need to code that functionality into the "key down" event of the combo box in VBA.

I could thow something together for you if you like. I encourage you to try it for youself first, though.
Dec 11 '09 #2
missinglinq
3,532 Recognized Expert Specialist
I can only replicate your problem by entering a QTY, tabbing into the Item Combobox, then Tabbing again, which is, as you said, trying to go to the next control. If you tab into the Combobox and use the mouse to drop down the box, everything works fine.

What I'd do, simply to decrease the chance of hitting Tab twice and popping the error, would be to automatically drop down the box when entering it:
Expand|Select|Wrap|Line Numbers
  1. Private Sub ItemComboBoxName_GotFocus()
  2.  ItemComboBoxName.Dropdown
  3. End Sub
Linq ;0)>
Dec 11 '09 #3
DanicaDear
269 Contributor
Ok, I was going to take Delerna's approach and try to come up with something myself....but I figured I was going to have to ask for a hint. Do you just need a good VBA book to learn what GotFocus() means, for example? My Access book has a chapter on VBA....but I'd need a listing of all the commands.... something more in depth.

I haven't had a chance to try your idea Linq but it looks like that is the exact direction I want to go.
Dec 14 '09 #4
missinglinq
3,532 Recognized Expert Specialist
Here's a couple of sites that go into VBA:.

Chrystal has an excellent “basics” tutorial:

http://www.accessmvp.com/strive4peace

Jeff Conrad's resources page:

http://www.accessmvp.com/JConrad/acc...resources.html

Linq ;0)>
Dec 14 '09 #5
Delerna
1,134 Recognized Expert Top Contributor
Just a word of advice using got focus and lost focus events.

Take care because your code can quite easily be sent crazy bouncing around the various got and lost focus handlers of your controls.

Got focus of control1 and code in there causes control2 to get focus which cause lost focus of control1 to fire and code in got focus of control2 causes control1 to get focus.so got focus of control1 fires again as well lost focus of control2.

It quickly becomes quite hairy.
Try hard to use other events instead of got and lost focus wherever you can
Dec 14 '09 #6
missinglinq
3,532 Recognized Expert Specialist
Take care because your code can quite easily be sent crazy bouncing around the various got and lost focus handlers of your controls....

Got focus of control1 and code in there causes control2 to get focus
I'm sorry, but the code can't be sent bouncing any crazier than the scenario you presented! What possible reason would anyone have to place code in control1_GotFoc us to send the focus to control2, as you suggest?

All events have to be used properly, paying attention to when they fire and exactly what triggers them, but making a statement like this about GotFocus and LostFocus is simply inane and gives a totally false impression!

Linq ;0)>
Dec 14 '09 #7
Delerna
1,134 Recognized Expert Top Contributor
I was merely trying to illustrate a point and chose an over the top example to illustrate it.

I have had experience debugging a database written by a colleague who found many inventive ways to use got and lost focus for many controls on the same form. The problem was that code written in other events caused the mentioned events to fire in unexpected ways, unexpected to my colleague that is, due to his inexperience at writing software. Indeed, I myself suffered the same experience when starting out. I found that inappropriate use of those 2 events in particular more troublesome, more difficult to get my mind around, more difficult to debug than any other.

I certainly do not wish to give a false impression, just sharing my observations.
Having said that,
it certainly is true that
All events have to be used properly, paying attention to when they fire and exactly what triggers them
Dec 15 '09 #8
DanicaDear
269 Contributor
As always, thanks for the thorough explanations. I'm always appreciative. I haven't grasped the whole GotFocus concept yet but I'm working on it. (I've been away from Access for awhile...which is not smart for me!)

Moving on....I got the GotFocus and .Dropdown as referenced above to work in the form. However, the form is a subform used on another form. It wouldn't work in the main form. (It just behaved as if the code weren't there at all, and the original problem is still my problem.) Any ideas why it works on the subform when it is opened all alone and not on the mainform that contains it?
Thanks in advance!
Danica
Jan 19 '10 #9
Delerna
1,134 Recognized Expert Top Contributor
Hi Dancia
Have you tried putting breakpoints on the events coded in both the main form and the subform and then running your form and making the change. That way you can trace throught the sequence of events looking to see if things are happening as you expected. It is also a good method to learn which events fire and in what sequence they fire. Keep in mind that when your code stops at a breakpoint, you can hover your mouse pointer over variables and see their contents.

Breakpoints are also great for examining how a piece of code works even when there are no errors.
Just breakpoint every line of the code you want to examine, and the cause it to execute.
You can then watch the execution of the code, hover over variables/objects at each step and see how the code is changing them and all manner of useful things.
You can even drag the execution point to a different line,
change code on the fly, the list goes on and on.

Effective use of the debugger is the primary tool that will enable you to answer your own questions.....n ot that I am trying to discourage you from asking questions here.


Anyway, you will need to post the piece of code that you believe is at fault along with a clear desciption of what is happening.
I assume that
the original problem is still my problem
means
a message box pops up telling me that a primary key field can't be null
but you know what happens when you assume things.
My initial thought is that you are trying to move focus from the main form to the subform but a key field on the main form has not been filled in, but I am just guessing
Jan 19 '10 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

10
7637
by: Ryan McGeary | last post by:
In a <select> drop-down, the onchange event isn't called when scrolling through the dropdown using the mouse-wheel and when crossing over a new <optgroup>. Using the example below, notice how the onchange event isn't called when mouse wheel scrolling between A3 and B1, but it works properly when scrolling between A1 and A2. E.g. ------------------------------------------
3
23308
by: Darren | last post by:
Please Help Me!! I've created a typical <form> and a <select> element. The options are created dynamically from my access database (using asp). There are about 70 options, and when you click the dropdown button, it shows about 25 (depending on screen resolution) and then the gives you a scroll bar to get to the rest. My question is, can I limit the number of options shown when you click
5
2592
by: EviL KerneL | last post by:
Hi - I am trying to figure out a way to enforce the validation included for this form based on whether the user chooses "email" or "phone" as the contact choice. Right now it is set to enforce validation on both. Is there a way to link the drop-down choice to the correspondent validation section while disabling validation for the other one? here's what I presently have:
0
2588
by: Andy Bates | last post by:
I've got what at first appears to be a really simple problem. I have a dropdown combobox with a list of names in, the user can enter text into the edit portion or drop the combobox and select a name. What I need to do is to drop the combobox when the user types and find the nearest entry to what the user entered (so if they typed A, Andy may be the nearest entry, the list should scroll, but not select, unless the user uses arrow down...
5
2624
by: MacKenzieMouse | last post by:
Is there an easy way to have the page scroll to the next button? When I populate a drop down list box, I have to use the arrow key or the mouse to scroll down. I would like for the page to be positioned at or near the bottom. I have turned smart navigation on. That helps, but still isn't enough. Thanks
3
6152
by: Don Wash | last post by:
Hi There! I have a Server-side Drop-down box in ASP.NET (VB) page. What do I do to widen the Drop down box's Pull-Down list's width? I'm not talking about the Drop-down box's width but the box that appear when user clicks the drop-down arrow button. Because items in the Drop down list are a little long, user can't see the full thing when they pull down the items from the drop down list.
3
3189
by: excel_hari | last post by:
Hi, I couldnt locate a Classic ASP group hence posting here. One of my colleagues has designed an intranet site and one of the pages has a drop-down box with close to 300 options. I want to navigate to the desired option quickly just by typing out the name. For example if I want to choose "Other" (All the options are arranged alhabetically within the Drop-down box) from Drop-down and if I Type "O" then I navigate to first entry with...
4
2330
by: Botondus | last post by:
Ok so i have a a couple drop down menus, that are used as filters. I mean to select filters for a listing of products. They work perfectly in Firefox, however in IE the drop down doesn't activate every time it should. If you check the code fragment from my template below, the bold part is the text on one of the filters and a small arrow image. In IE if you put the mouse cursor between the text and the arrow the drop-down doesn't trigger, which...
1
1251
by: laks2886 | last post by:
Hi.. I have a page where i have some drop downs whose defalut value is set to "All". unlike the other cases where, when we click on the drop down arrow we get a list items to select. Clicking on the items and getting a pop up is easier. But Now my requirement is on click of this drop down arrow a pop up extender(Ajax) has to be opened. There should not be any list items below as in the normal case. please see the image in the...
0
8165
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
8670
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
8613
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...
0
8469
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
7150
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
6106
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
4074
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
4164
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1473
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.