Using a combobox in the tab order of a fformm (1 Viewer)

jpl458

Well-known member
Local time
Today, 11:13
Joined
Mar 30, 2012
Messages
1,038
I have a data entry and have 4 text boxes in a column, and next to each entry is a combobox:

1664474230253.png

in the comboboxes there are three(for now) options that the user can select that classify the contact in the text box. All the fields are bound to the Master Table.
I have the field set up in the tab order like this:

1664474490196.png


in the top textbox, in the lostfocus event I have the following:
Code:
Me.Ct1cb.Visible = True

The problem is that the 1st combo box seems to get the focus, it becomes visible, I can make a selection, but I notice that the cursor is already located in the second Textbox. So when I should be tabbing out of the first combobox, I am actually tabbing out of the second textbox, which opens the hidden CT2cb combobox. It appears that a combobox cannot be in the tab order, but everything I've read is to the contrary. I've wasted pretty much of a day trying to figure this out. Just tried it after posting and found this: As soon as I make a selection in the combobox the lost focus event in the second textbox activates opening the second combobox.

Let me know if you need more information, but I think I supplied all that I have.
 
Last edited:

bastanu

AWF VIP
Local time
Today, 11:13
Joined
Apr 13, 2010
Messages
1,402
Your design does not follow relational database design (not properly normalized), soon you might need a fifth and sixth contact and you will have to change all the objects involved. But back to your question, what is the current tab order? Txt1,cmb1,txt1,cmb1,....?
Try to use the AfterUpdate of the textboxes to unhide the corresponding combo and maybe in the AfterUpdate of the combo force a SetFocus on the next textbox.
Cheers,
 

jpl458

Well-known member
Local time
Today, 11:13
Joined
Mar 30, 2012
Messages
1,038
Your design does not follow relational database design (not properly normalized), soon you might need a fifth and sixth contact and you will have to change all the objects involved. But back to your question, what is the current tab order? Txt1,cmb1,txt1,cmb1,....?
Try to use the AfterUpdate of the textboxes to unhide the corresponding combo and maybe in the AfterUpdate of the combo force a SetFocus on the next textbox.
Cheers,
I tried GotDirty event in the textboxes to open the combo boxes an it works, so far. Will enter some test data to see if it continues to work. This is a very small, self contained database. No Backend. It doesn't need normalization, it's just a spot of record keeping and there will never be more than 4 contacts. Codd and Date can rest easy. I will try your solution.
Thanks
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 14:13
Joined
Feb 19, 2002
Messages
43,276
Are you saying that the tab order does not work correctly?

If you could tell us in words how you want the form to work, we can probably suggest the correct events to use.

If you are trying to use control over the focus to ensure that various controls get input, that is the wrong approach. If you have dependencies, the best solution is to use the Form's BeforeUpdate event to ensure that if fldA has data, then fldB also has data.
 

Users who are viewing this thread

Top Bottom