Combo Box Statements

raymond3090

Registered User.
Local time
Today, 23:15
Joined
Sep 5, 2002
Messages
43
Hi!

I have some combo boxes on my forms that are controlled by fields in an underlying table. The form is used for data entry, and if the data for one of these particular fields is already present, they just select it from the list and avoid needless typing.

I currently have it set up such that if the user needs to enter new data into one of these fields, then they double-click the field and a new form pops up to add this particular data type. The new data is then added to the combo box, where the user can easily select it.

My problem is that sometimes the users don't realize that this is a combo box and try to enter data into this field. I have a 'notinlist' condition in there to prevent them from entering new data this way. However, this can make people mad sometimes because they already have it typed out and then have to type it out again when they realize that they have to double-click to add new data.

What I would like is a display in my combo box saying something like 'Select From List'. These fields are not required however, so if they leave the field like this, the corresponding field in the table would be empty.

Also, when the user enters new data to appear in the combo box, they have to then select it from the combo box list. Is there a way that I can have the new combo box item automatically selected in the combo box as soon as that form is closed so that they don't have to select it? (I realize that probably wasn't very clear!)
 
My problem is that sometimes the users don't realize that this is a combo box and try to enter data into this field. I have a 'notinlist' condition in there to prevent them from entering new data this way. However, this can make people mad sometimes because they already have it typed out and then have to type it out again when they realize that they have to double-click to add new data.

If you can pop up a form on a double-click, you can copy the code to pop up that same form from other events.

In the control's {combobox}_Change event, you can see each keystroke as it comes in. (Each keystroke is one change event.) So if you see a change that looks like a single keystroke, IMMEDIATELY test it for your "not in table" situation. Or perhaps it would be good if you made sure that no valid response was ever exactly one character long. Or, you could set the form's autofill for that control.

The point is, you can trap that first character if you wish. There is also an event for each keystroke and a way to find the current position of the cursor at the time of a mouse-click, having nothing to do with the control's click event. (Actually, in some circumstances, both could be triggered.) So you could tell by looking at the mouse coordinates and the control's Left, Top, Height, and Width properties whether the mouse click was in the vicinity of the drop-down button.

If you see that single-character data entry and it didn't come from a combo-box click AND doesn't appear to be in the validation table already, don't ask them to double-click. Instead, YOU pop up the form that a double-click would have popped up. Then copy the contents of the control in question to the appropriate data entry control in the pop-up. That way, they don't have to retype everything.

Also, when the user enters new data to appear in the combo box, they have to then select it from the combo box list. Is there a way that I can have the new combo box item automatically selected in the combo box as soon as that form is closed so that they don't have to select it? (I realize that probably wasn't very clear!)

If your validation table (because that is what this pop-up controls) uses an autonumber as a prime key, you could remember that you had just popped up the form. (Use a Boolean flag for this purpose: Did I trigger the pop-up form?) You could do a DLookup from the table to pre-load the control.
 

Users who are viewing this thread

Back
Top Bottom