views:

623

answers:

4
+1  Q: 

checked list box

Hi

I am new to Access and i am in the process of creating a database for some of our users. I have designed a form where the user name, first and last name etc are inputted.
Some of these users work for more than one department which means I need some type of listbox control that allows them to select more than one department when they enter their contact info.

In VB Studios 2005, this control is called a CHECKED LISTBOX. I have looked everywhere in access but cant seem to find it or anything closely similar.

The option of a listbox or combobox is not feasible here as these only allow the user to select one option only when inputting their details. Any help with this is much appreciated.

+2  A: 

Use an ordinary list box with the "Multi Select" property set to "Simple".

The user can then click multiple list items, all of which stay selected until they un-select them again.

Tomalak
thanks for this info. I have tested and this is exactly what i am looking for.
TT1611
+1  A: 

You may wish to consider a subform, as this will save you the trouble of updating a table with the data from a list box. A subform can use a department-person junction table with person id as the linked child field and master field. A combobox bound to department id will allow the user to select departments.

Remou
Thanks for this info Remou. I am not sure if i wanted to go with this approach seeing that the system already has about 6 forms in total that the user eventually need to fill. The user details form is just a small part of my database and the relational model initially requires user details. Do you have any info on my comment to Renaud below?
TT1611
+1  A: 

If you are really set on having checkboxes, Stephen Lebans has a sample database that uses the built-in Access listbox with checkboxes (from one of the Access wizards).

David-W-Fenton
A: 

There is another choice:

If you are using Access 2007, you can declare your field as a lookup field accepting multiple values. When you bind the list box to that field, you will get checkboxes.

It's easy to use them.
You'll also find more information is available from the MS Office website.

However, note:

  • This is only possible in the new Access 2007 database format and you will not be able to save your database to the older MDB format.

  • Multiple value fields are not compatible with most other databases, meaning that if you decide one day to upsize to SQL Server, you'll have to redesign your tables to use a junction table as Remou mentioned.

  • These multi-value fields are difficult to use from VBA: the value they return is in fact another recordset that you must iterate through to get all the values.

Having said that, if you just want something simple and you're not planning on manipulating the database from code, then it can be a practical option, albeit not a very compatible or future-proof one.

I'm not using them, but I think others should be able make their own decision knowing what is available to them.

Renaud Bompuis
I have not yet encountered people having problems with look-up fields in 2007, which these are, but in previous releases of Access, people constantly had trouble with this sort of set up, especially with queries.
Remou
Thanks for the information. I am actually designing this database in access 2003. Its funny you should mention this because when I changed my listbox multiple select property to simple as suggested by Tomalak, i now have the option of choosing more than one item in the list. However even though my listbox is bound a field in the table, there are no records in the field. The same is true whether i make multiple/single selections. Can you or anyone advice on this?
TT1611