Link to home
Start Free TrialLog in
Avatar of Daniel Van Der Werken
Daniel Van Der WerkenFlag for United States of America

asked on

How to store and retreive multilpe values in a multiselect List box in MS Access 2010

Hi,

I have a multiselect List Box on a form in a MS Access 2010 database and I want the user to be able to select one or more values from the box (based on a customer's personal information).

Of course, I want this information (value selections) to save in a child table. Second, I want to be able to retrieve and display the same highlighted selections automatically based on that customer ?

How would I be able to achieve this task ?

Any help would be extremely appreciated.

Thank you !
Avatar of Jeffrey Coachman
Jeffrey Coachman
Flag of United States of America image

But it is not clear what you are wanting to do here there...

<...I want the user to be able to select one or more values from the box (based on a customer's personal information)...
...Of course, I want this information (value selections) to save in a child table...
...be able to retrieve and display the same highlighted selections automatically based on that customer...>

Please explain in greater detail...
Perhaps it would be simpler for them to simply "enter" this info directly into the child table via a combobox...?
Avatar of Daniel Van Der Werken

ASKER

I have a combobox with 5 values that they may select from. These values are based on a device that a customer is using (for instance, a printer or a scanner or a fax machine, etc.). The user selects however many of these list items that the customer's device operates as.

I want that selection to save in a table and display in the form whenever the user brings up a customer's record.

So if there is a device that functions as a printer and a fax, and the user selects those two functions (and that selection is stored in a table), then I want that selection to display when the user pulls up that specific customer record.
I am still very new to DB programming and MS Access 2010 and unfortunately for me, the user has requested that they have selections rather than pure text entry fields.
Then this is a compound question.
Design
Build

Try this simple example first
Database89.mdb
I like your example but let me correct myself.

I have a *listbox, not a combobox. The listbox includes Fax, Printer, Copier, and Scanner.

I already have the listbox built to include those values and the user can select one or more of those. Based on the user's project requirements, one equipment device may actually include any of the features/functions contained in the listbox.

So if the user selected fax and printer for a specific equipment device, I would like that selection stored within a table. Without displaying any IDs on the form, how would I store that in a table ? When you actively select fax and printer from the listbox in the form, those values are highlighted in black. Is there any way that I would be able to display those values as highlighted when the record is displayed in the record ?

My apologies but I suppose this is actually a 3 part question:
1 ) How would a multiselection from a listbox be stored within a table ?
2 ) How can the info be retrieved in the form if the user wants to look at the record (without looking in the table) ?
3 ) How can I display the selection in the record form so that it appears highlilghted in black ?
You can do it but it may be a bit complex if you are new to:
Access
Form design
VBA

My combobox solution will work, ...are you saying that you want what you want regardless of the complexity and if you understood what was being done?
I have specific requirements from the user, unfortunately, but that's expected. A subform on a form won't quite work for what the client wants.

I have coded some of my DB. If you provide some code with explaination on what it does and where I should put the code and it should be fine.

Any suggestions for coding based on the 3 part question above ?
ASKER CERTIFIED SOLUTION
Avatar of Jeffrey Coachman
Jeffrey Coachman
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks...

I did not want to seem like I was trying to give you a hard time.

Just that the design the customer wanted will probably lead to more questions..
:-(

For example
-How to stop the user from clicking the button twice?
-Creating the same system for "removing" devices?
-What happens if you are adding a new Customer?
...etc

Finally note that if you select the same device twice, it will alert you.
I added this validation in myself, ...if I didn't, you would have surely posted another question on how to prevent this...
;-)


Jeff
Now how do you do the same thing with a multiselect combobox? I've tried code similar to yours, Jeffrey, in an attempt to add multiple combobox selections to a string variable but it just ain't working.

Than