Results 1 to 2 of 2
  1. #1
    Charlie is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jan 2013
    Location
    Australia
    Posts
    1

    Multi select rows in recordset

    On a form several rows of data are displayed in the detail section.


    The user can multi-select rows just like a list box.
    I want to scan the selected rows and extract data from them.

    Using the Forms recordset or Recordsetclone (or any other) is the any way of identifying the selected rows please? eg Me.Recordset.Selected (this property does not appear to exist)
    Getting the selected rows from a listbox is ok but is there a similar option for the form's recordset?
    Thx

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Yes, I do something like that to allow multi-record select/delete. Will try to give a modified version. I pulled lines out of my procedure to give you something that looks relevant to you but not tested:
    Code:
    Sub btnDoSomething_Click()
    Dim intHeight As Integer    'stores value for number of records selected
    Dim N As Integer 
    With Me.RecordsetClone
    intHeight = Me.SelHeight
    If .RecordCount < 1 Then
        MsgBox "No records.  Action canceled.", , "Error"
    ElseIf intHeight < 1 Then
        MsgBox "No records selected.  Action canceled.", , "Error"
    Else
        .AbsolutePosition = Me.SelTop - 1    'AbsolutePosition property is 0 based counter so must -1 to set pointer in recordsetclone to record matching the top record in form selected records
        For N = 1 To intHeight
            'Do something with record
            .MoveNext
        Next
    End If
    End Sub
    Last edited by June7; 02-01-2013 at 01:53 AM.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 5
    Last Post: 07-26-2012, 12:59 PM
  2. How to Select second Recordset from first recordset
    By FrustratedAlso in forum Programming
    Replies: 28
    Last Post: 05-10-2012, 05:45 PM
  3. Replies: 6
    Last Post: 04-07-2011, 12:33 PM
  4. select records in recordset
    By sksriharsha in forum Programming
    Replies: 3
    Last Post: 09-05-2009, 11:40 AM
  5. Replies: 1
    Last Post: 06-01-2009, 01:09 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums