Results 1 to 3 of 3
  1. #1
    andy49's Avatar
    andy49 is offline VIP
    Windows 10 Access 2010 64bit
    Join Date
    Nov 2016
    Location
    London
    Posts
    1,051

    Reordering a form

    I'm not sure why this doesn't work. I have a continuous form whose query is not updatable so the form is populated using

    Code:
    Dim rst As DAO.RecordsetDim db As DAO.Database
    
    
        Set db = CurrentDb
        Set rst = db.OpenRecordset("qrydoesthiswork")
        If Not rst.EOF Then
            Set Me.Recordset = makeADORecordset(rst)
         
        End If
        rst.Close
       
        Set rst = Nothing
    When the form opens. This works absolutely fine.

    I've now been asked to be able to reorder the form and I assumed I could use:



    Code:
    Private Sub cmdsortscore_Click()
    Me.OrderBy = "TotalScore"
    Me.OrderByOn = True
    End Sub
    This works fine reordering the data according to total score.

    However when I click on another button to order the data by Surname again using:

    Code:
    Private Sub cmdsortname_Click()
    Me.OrderBy = "Surname"
    Me.OrderByOn = True
    End Sub
    The page doesn't reorder.

    I've since noticed that reordering by anything only works if its the first button you press.

    Can anyone put me straight here please?

  2. #2
    ranman256's Avatar
    ranman256 is online now VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    you dont need any code to do this.
    make a query assign it to the form.

    also with the code for sorting....all can be done on the screen with the mouse.

  3. #3
    andy49's Avatar
    andy49 is offline VIP
    Windows 10 Access 2010 64bit
    Join Date
    Nov 2016
    Location
    London
    Posts
    1,051
    Thanks Ranman256 When I assign the query to the form it says the query is not updateable so I cant add data. That's one of the purposes of this form.

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

Similar Threads

  1. Reordering Tab Order
    By snowboarder234 in forum Forms
    Replies: 1
    Last Post: 06-16-2016, 02:31 PM
  2. ReOrdering ID values
    By duckduck in forum Access
    Replies: 2
    Last Post: 05-24-2012, 04:40 AM
  3. Reordering Columns In Access
    By samanthaM in forum Access
    Replies: 1
    Last Post: 05-12-2012, 11:34 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