Can I only list one code per list box or combo box (1 Viewer)

bridge

New member
Local time
Tomorrow, 00:27
Joined
Jan 30, 2010
Messages
3
I have created a table with 50 different codes. When I use a list box in a form (having created a relationship) can I only use one of these codes. I would like to use several if possible.
 

wazz

Super Moderator
Local time
Today, 21:57
Joined
Jun 29, 2004
Messages
1,711
hi. we need more info. but, a listbox can be either single-select or multi-select. on a multi-select list you would have to be able to loop through the selected items on the list (in code) to get what was selected in order to use them.
 

bridge

New member
Local time
Tomorrow, 00:27
Joined
Jan 30, 2010
Messages
3
I new at access. In my toolbox (when I am in design veiw of my form) there is a list box how can I make it multi-select. Thanks for your quick response.:)
 

wazz

Super Moderator
Local time
Today, 21:57
Joined
Jun 29, 2004
Messages
1,711
when you are designing you will need to see the properties of the thing you are working on. right-click 'the thing' and select properties (or view -> properties). have a look at all the properties (for familiarity). you will find multi-select in there.
 

bridge

New member
Local time
Tomorrow, 00:27
Joined
Jan 30, 2010
Messages
3
Thanks WAZZ.

Ok. I have a multi list now. When I created I used a wizard. My first choice was to use a table I had created a relationship with. The last option I chose to store the value in the correct field (course code). Basically I have 50 4 diget codes in the tabel and they are all showing when I scoll down the multi list box. However I can't select the specific codes from this list. What am I doing wrong? Thanks for your help :)
 

vbaInet

AWF VIP
Local time
Today, 13:57
Joined
Jan 22, 2010
Messages
26,374
Select as in select text within a "cell" on the list control?
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 13:57
Joined
Sep 12, 2006
Messages
15,614
but in terms of binding the list box to a field in a table - then its single value only

a multi value list box has vaildiity with unbound data

say you have a list of US states - you want to select certain states, and then use these to process selected data. but you cant save these multi-values in a single field

(having said all this, maybe you can do what you want in A2007, as they now have multi-value fields i think - trouble is, its non-relational so its not something we would expect to be able ot do)
 

vbaInet

AWF VIP
Local time
Today, 13:57
Joined
Jan 22, 2010
Messages
26,374
I didn't quite follow what you said Dave. A listbox returns a single value but you can also get the values of the other columns as long as you know the index. A quick loop through the columns would enable you "pick" and save the values.
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 13:57
Joined
Sep 12, 2006
Messages
15,614
I didn't quite follow what you said Dave. A listbox returns a single value but you can also get the values of the other columns as long as you know the index. A quick loop through the columns would enable you "pick" and save the values.

IN A BOUND FIELD/FORM

if you have a field in a table of type text say

then if you have a listbox bound to this field, it will show the single value stored in the field - not multiple values

IN AN UNBOUND FIELD

you can select multiple values - but if you want to save them, you will have to store them in some data structure (array?), and even then you will probably lose them when you close the app

MULTI-VALUE FIELDS

it then occurred to me that in A2007, there is now a multi-value field (although I am not familiar with the details - and it is clearly non-relational) - but it occurred to me that maybe this might allow you to save ALL the values of a multi-value list box in a single field.

hope that all makes sense
 

vbaInet

AWF VIP
Local time
Today, 13:57
Joined
Jan 22, 2010
Messages
26,374
I've just (by chance) come across read the document from Microsoft just giving an overview of the so-called multivalued fields. You were right to say they are non-relational. To retrieve the values you have to use code (dao recordsets) which has a child recordset. Pretty useless really. Anyone would have been able to do that and split the string accordingly.
 

Users who are viewing this thread

Top Bottom