Re: List question
- From: "Allen Browne" <AllenBrowne@xxxxxxxxxxxxxx>
- Date: Wed, 9 Aug 2006 10:21:50 +0800
This is very easy to do if you use 2 tables.
The heart of relational databases like Access is the one-to-many idea. If
you have many things related to one thing, you create another table where
the many things become many records.
Here's some resources that explain the basics of this:
http://home.bendbroadband.com/conradsystems/accessjunkie/resources.html#DatabaseDesign101
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
"chouetteray" <chouetteray@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:CEED8659-7DCF-4B0C-B67A-23C23FD5A11B@xxxxxxxxxxxxxxxx
Hi Allen, I'm not sure what you mean. So, you're saying I create a new
table
to store the values selected but how do I make the form look similar?
Right
now it's a list of values that the user can select 1+.
"Allen Browne" wrote:
Use a subform instead of a mutli-select list box.
If there are many choices applicable to the main record, you *really*
need a
related table (one to many relation) to store the many choices for the
one
record. Once you have that, it is very easy to create a subform in
continuous view so you can enter as many lines as you need in the subform
for the entries that apply to the record in the main form. No code
needed.
If you do have a related table to store the records in, but you want to
use
the multi-select list box, you will need to write a considerable amount
of
code to correctly populate the list box in the Current event of your
form,
restore it in the Undo event of the form, dirty the record in the Click
event of the list box (so that the changes will get written), and
programmatically loop through the ItemsSelected collection of the list
box
in the AfterUpdate event of the form to execute a delete query for any
item
that is no longer selected, and an append query for any item that is now
selected by was not previously.
That's not trivial code, so use the code-free subform approach if you are
not sure about how to do that.
"chouetteray" <chouetteray@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:6D8D8302-209D-4456-AEE4-A8164F8E584F@xxxxxxxxxxxxxxxx
I created a list box with the multi-select set to simple. How do I get
my
list box to store the values selected in the database?
.
- References:
- Re: List question
- From: Allen Browne
- Re: List question
- Prev by Date: Re: Combo box - Record Find - Start Typing - Results Pop Up
- Next by Date: Re: Last Modified
- Previous by thread: Re: List question
- Next by thread: Re: is there a with command buttons
- Index(es):