Results 1 to 2 of 2
  1. #1
    PoorCadaver is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Oct 2011
    Posts
    68

    Sort form using drop-down

    I'm trying to build a sort-combo box. When I click a post in the combo box (qSort) I want my sub form to be sorted according to my selection.



    I thought you could write a code like this:

    Code:
    Private Sub qSort_AfterUpdate()    
        If Me.qSort.Value = "ID" Then
            Me.frmRegisterList.Form.Query = qryUnitList_ID
        
        End If
               
           
        Me.Requery
        
    End Sub
    This didn't work and if I do like this I have to make several querys that I can load that are sorted in different ways. Aren't there a better way?

  2. #2
    DepricatedZero's Avatar
    DepricatedZero is offline Cthulhu Fhtagn!
    Windows 8 Access 2007
    Join Date
    Apr 2013
    Location
    Cincinnati
    Posts
    65
    Try doing something like
    Code:
    DoCmd.SearchForRecord acDataForm, "frmName", acFirst, "[field] =" & "'" & EscapeString(Me.cboSearchString) & "'"
    That will update the record that your parent form is bound to, which should also update the subform. Will that work for you?

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

Similar Threads

  1. sort filter, doesn't sort everything
    By deso in forum Queries
    Replies: 4
    Last Post: 01-25-2013, 05:27 AM
  2. Form Drop down box
    By nyneave in forum Forms
    Replies: 1
    Last Post: 10-16-2012, 03:02 PM
  3. Sort order in a sub form
    By roar58 in forum Forms
    Replies: 1
    Last Post: 03-17-2012, 08:57 PM
  4. Replies: 3
    Last Post: 12-30-2011, 01:20 PM
  5. Replies: 3
    Last Post: 11-29-2011, 07:01 AM

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