Results 1 to 2 of 2
  1. #1
    2 Star Lounger
    Join Date
    Jan 2001
    Portland, Maine, USA
    Thanked 0 Times in 0 Posts

    Using a listbox instead of checkboxes (Access 97)

    I have created a database to track police officers use of force. A very simple database that tracks an officers use of force against a subject. I have a table called tblIncident which consists of information about the officer and the subject in question. I have a separate table called tblControlType which lists all the objects like firearm, baton, mace, ect... My 3rd table is a junction table linking the id from tblIncident to the id from tblControlType. (Many-to-Many) I was originally going to include all the fields like firearm, baton, ect... as yes/no fields in tblIncident because it's all related but due to the fact that Types of control could be added in the future, instead of adding additional check boxes on the forms all we have to do is add a record to tblControlTypes.
    My form is set up with all fields pertaining to the officer and subject with a listbox which lists all the items from tblControlTypes. When a new record is entered you enter the officer name, date, time, subject information, ect... and then select the types of force used in the multiselect list box. In the afterupdate of the listbox a record is created in the junction table linking the type of force used to the officer. This is all working fine. My problem is how to have the list box display the types of control used as selected when the form is opened to an existing record?
    Basically I always want all the items from the Control Types table to be listed in the list box on the form, but for existing records I want the types of controls related to the record to be selected.
    I'm getting very confused trying to explain it. I'll give a quick example.
    An officer named Joe Blow used his baton and mace on the subject. So I enter Joe Blow and the other information about the incident, then I select baton and mace from the multiselect listbox. I close the form and then open it. Joe Blow and the other information is there but the listbox obviously doesn't have any selections in it. How can I have it select baton and mace, the related records in the junction table, on Form Open or OnCurrent?

    I hope someone can understand what I'm trying to do.
    Thanks for any input.

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Sacramento, California, USA
    Thanked 1 Time in 1 Post

    Re: Using a listbox instead of checkboxes (Access 97)

    Multiselect listboxes are used as input tools for things like batch processing. They are not intended for display of data.

    Unlike regular listboxes and comboboxes, they don't have a single value, so you can't just bind them to a field and have them display the selections. I would suggest you use a subform instead of a multiselect to enter and display one-to-many values.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts