Solved Show values of a multivalue combobox in a textbox (1 Viewer)

anski

Registered User.
Local time
Today, 13:28
Joined
Sep 5, 2009
Messages
93
How can I show all the chosen values in a multivalue combobox in a textbox? When only one value is chosen, this value appears in the textbox. But when more than one value is chosen, the textbox does not show anything.
 

Gasman

Enthusiastic Amateur
Local time
Today, 06:28
Joined
Sep 21, 2011
Messages
14,299
Well if it was a multivalue listbox, I would walk through the list and concatenate all those selected into a string variable and then set the textbox control to that variable.
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 22:28
Joined
Oct 29, 2018
Messages
21,473
That doesn't sound like a normal behavior. Try adding a new combobox using the Wizard just to see if the problem is the same.
 

GPGeorge

Grover Park George
Local time
Yesterday, 22:28
Joined
Nov 25, 2004
Messages
1,867
How can I show all the chosen values in a multivalue combobox in a textbox? When only one value is chosen, this value appears in the textbox. But when more than one value is chosen, the textbox does not show anything.
There are inherent limitations to multi-value fields. There is no such thing as a "multivalue combobox" in the interface, so this must actually be an MVF in the table. There are techniques for extracting data from these things, and there are experts here who've taken the deep dive to figure out how to do that.

However, the more standard, reasonable approach is to avoid them in favor of a proper relational table design.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 13:28
Joined
May 7, 2009
Messages
19,243
here is a sample on how to get the values of the MVF.
open SampleForm form and choose values from multi-value field (Idx).
 

Attachments

  • MVFToTextbox.accdb
    608 KB · Views: 61

anski

Registered User.
Local time
Today, 13:28
Joined
Sep 5, 2009
Messages
93
here is a sample on how to get the values of the MVF.
open SampleForm form and choose values from multi-value field (Idx).
thanks arnelgp. this correctly shows in a textbox all the chosen values in a combobox. how do i show the corresponding name? the values shown are the account codes. i would like to show the corresponding account names.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 13:28
Joined
May 7, 2009
Messages
19,243
you need to add Dlookup() to fetch the actual account names.
upload a db and i will show it to you.
 

Gasman

Enthusiastic Amateur
Local time
Today, 06:28
Joined
Sep 21, 2011
Messages
14,299
Wouldn't a recordset be better with IN()?
 

anski

Registered User.
Local time
Today, 13:28
Joined
Sep 5, 2009
Messages
93
you need to add Dlookup() to fetch the actual account names.
upload a db and i will show it to you.
i used your db. however, i noticed that when i close the form and open it again, the values are no longer shown. i have to open the combobox and click on ok again for the values to be shown in the box.
 

Attachments

  • MVFToTextbox (1).accdb
    608 KB · Views: 61

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 13:28
Joined
May 7, 2009
Messages
19,243
here try it now. also check the code on idx_AfterUpdate event and the form's current event.
 

Attachments

  • MVFToTextbox (1).accdb
    476 KB · Views: 59

Users who are viewing this thread

Top Bottom