Results 1 to 4 of 4
  1. #1
    Join Date
    Jul 2010
    Posts
    2

    Unanswered: Access 2007 noob having trouble changing a listbox into a multiple value listbox.

    Hi, I've had a look through the forums and haven't been able to find anything on this, but apologies if it's been answered before. I'm new to Access, and hope I'm using the right terms.

    On the translationdatabase I've inherited from a colleague who's now left we have listbox on the main input form which we use to select the topic of the translation (ie economics, politics, history, sport, entertainment etc) and it populates a field in the record in the main table of the database. What I'd like to do is to change it and make it so you can select multiple values and therefore be able to label a translation as economics AND history rather than just economics or history, for example.

    I'm really not sure how to do this however, would it involve programming?

    Thanks in advance!

  2. #2
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    Don't run version 2007, so I can't give you a step-by-step on this, but in Design View for the form, select the listbox then (however you do it in v2007) go to

    Properties - Other

    and change the Multi-Select Property to from None to Simple or Extended, depending on how you want to make the multi-selections.

    Linq ;0)>
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  3. #3
    Join Date
    Jul 2010
    Posts
    2
    Hi Linq, thanks for replying.

    You can do that in Access 2007. I tried doing that, but after I've saved the record (we have a save record button) the two values I selected remained highlighted, and when I checked the table the record was on the field which should have been populated remained empty. Switch it back to None and it works again! Is there something I've missed off?

  4. #4
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    Yes, I suspect so! Code that works off of a Listbox with Multi-Select set to None uses the Value Property of the Listbox to populate a field. Once the Listbox has Multi-Select set to Simple or Extended it no longer has a Value Property, and you have to use a different syntax to assign the value!

    The general syntax would be something like this:
    Code:
    Private Sub ListBoxName_AfterUpdate()
     Dim varItem As Variant
      For Each varItem In ListBoxName.ItemsSelected
       Me.TargetTextBox = ListBoxName.Selected(varItem).Column(0) & ","
      Next varItem
    End Sub
    where ListBoxName is the actual name of your listbox, TargetTextBox is the name of the control you're assigning the selections to and assuming that the value you want to assign is the first (left most) field in the listbox.

    Linq ;0)>
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

Posting Permissions

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