Results 1 to 5 of 5
  1. #1
    Join Date
    Oct 2003
    Location
    Finland
    Posts
    80

    Unanswered: Form: Selecting records

    I need a form, which user could use to select multiple records by double-clicking a record. These records would then be passed on (by pressing Ok-button) to a report.

    So what I need is a list of the records, where user can click them and code for the Ok-button, which sends the selected records to report.

  2. #2
    Join Date
    Oct 2003
    Location
    Finland
    Posts
    80
    Oh, and I also need a list, that shows the records that the user has selected. It would also be nice if user could delete records from that list.

  3. #3
    Join Date
    Oct 2003
    Location
    Roanoke, Va
    Posts
    445

    Smile Re: Form: Selecting records

    Originally posted by Sham81
    I need a form, which user could use to select multiple records by double-clicking a record. These records would then be passed on (by pressing Ok-button) to a report.

    So what I need is a list of the records, where user can click them and code for the Ok-button, which sends the selected records to report.

    Sounds like you might want to use a listbox with the MultiSelect property set to simple or extended. This allows the multiple selection of line items.

    Gregg

  4. #4
    Join Date
    Oct 2003
    Location
    Finland
    Posts
    80
    okay... how does that work? Does anyone have an example of it?

  5. #5
    Join Date
    Oct 2003
    Location
    Roanoke, Va
    Posts
    445

    Smile

    Originally posted by Sham81
    okay... how does that work? Does anyone have an example of it?
    In this example I have used two listboxes, one called lst1 and the other lst2. All I'm doing is moving the selected items from one list to the other. You would need other code to clear the listboxes as needed.

    Add this to your OK button but set the lst1 and lst2 listbox names to what you call yours.

    Dim strValue As String, varItem As Variant

    If lst1.ItemsSelected.Count = 0 Then
    MsgBox "There are no items selected"
    Else
    For Each varItem In lst1.ItemsSelected
    lst2.AddItem lst1.Column(0, varItem)
    Next
    End If

    You need to add two list boxes to a form and set certain properties for each. Set the RowSourceType to coorespond with what your source of data is going to be. If it will be a table or query, set it to "Table/Query" and if adding manually with code, set it to value list. The other important property is the Multi Select property. Set this to Simple or Extended to allow multiple selections at one time. The only difference is the way you select them. See the help files for more details.

    Try it and see if it is what you need.

    Gregg

Posting Permissions

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