Issue with combo boxes keeping correct selection (1 Viewer)

tmyers

Well-known member
Local time
Yesterday, 19:07
Joined
Sep 8, 2020
Messages
1,090
I have been having an issue with combo boxes on my forms keeping the selected value when records are copied.
Here is a snip of what the form and combos look like before the record is copied.
Capture.PNG

However after the record is copied the combos lose their value. Is anyone able to explain why this happens? Is it an issue with how they are bound? What makes this even harder for me to figure out, is if I switch what column they are displaying, the maintain their value. The problem is it will display their ID number, which means nothing to the user.
,
Capture.PNG

The form is a subform and the combo is bound to TypeID, but retrieves the name via a query as a row source.
Capture.PNG

Capture.PNG

The subform that contains this is:
Capture.PNG



Any ideas?
 

tmyers

Well-known member
Local time
Yesterday, 19:07
Joined
Sep 8, 2020
Messages
1,090
I would like to say that I have this issue in several places. All are different sub-forms serve different purposes, but each displays the same thing, and they all do it.
 

Ranman256

Well-known member
Local time
Yesterday, 19:07
Joined
Apr 9, 2015
Messages
4,339
if you bind the combo to col.1 ,and pick A12, the result is A12.
you can still get the count from the 2nd col via: txtbox = cboBox.column(1)
(in vba, columns begin with zero)

if you bind the combo on col2, and pick A12. the result will be 53.
you willl no longer see A12.

Have 1 box get the Text value(combo bound col1) , and another text box grab the Numeric value. (=cboBox.column(1) , in the afterupdate event)
there's no need to have 2 boxes to collect the 1 value. The combo gives a value.
 

tmyers

Well-known member
Local time
Yesterday, 19:07
Joined
Sep 8, 2020
Messages
1,090
if you bind the combo to col.1 ,and pick A12, the result is A12.
you can still get the count from the 2nd col via: txtbox = cboBox.column(1)
(in vba, columns begin with zero)

if you bind the combo on col2, and pick A12. the result will be 53.
you willl no longer see A12.

Have 1 box get the Text value(combo bound col1) , and another text box grab the Numeric value. (=cboBox.column(1) , in the afterupdate event)
there's no need to have 2 boxes to collect the 1 value. The combo gives a value.
Edit:
Misunderstood. The count is displaying correctly. It is just type that is the issue. The count is bound to a query and displays something different. That works fine.
 

Pat Hartman

Super Moderator
Staff member
Local time
Yesterday, 19:07
Joined
Feb 19, 2002
Messages
43,216
Fix the properties of the combo so that they hide the ID but show the text string. There's something wrong with the properties. It also looks like you might be using a table level lookup. That is a problem to begin with. Get rid of the table level lookup. Use combos ONLY on forms/reports, Never on tables.
 

Users who are viewing this thread

Top Bottom