Solved

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

Posted on 2013-02-07
11
363 Views
Last Modified: 2013-02-07
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 !
0
Comment
Question by:Daniel Van Der Werken
  • 7
  • 4
11 Comments
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 38864952
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 38864971
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...
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 38864991
Perhaps it would be simpler for them to simply "enter" this info directly into the child table via a combobox...?
0
 
LVL 20

Author Comment

by:Daniel Van Der Werken
ID: 38865004
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.
0
 
LVL 20

Author Comment

by:Daniel Van Der Werken
ID: 38865010
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.
0
Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 38865219
Then this is a compound question.
Design
Build

Try this simple example first
Database89.mdb
0
 
LVL 20

Author Comment

by:Daniel Van Der Werken
ID: 38865294
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 ?
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 38865337
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?
0
 
LVL 20

Author Comment

by:Daniel Van Der Werken
ID: 38865399
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 ?
0
 
LVL 74

Accepted Solution

by:
Jeffrey Coachman earned 500 total points
ID: 38865422
Then these "specific requirements" will produce a non-standard/counter-intuitive interface that is prone to user missteps, thus requiring multiple levels of validation.

But here you go...
...in an event, I believe this addresses all of your concerns...

JeffCoachman
Database89.mdb
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 38865876
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
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now