Results 1 to 12 of 12
  1. #1
    Rick West is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Jul 2009
    Posts
    90

    Access 2003, sort order property of a form

    When opening a form, I would like it to sort like the query that drives it. (Ascending on 2 fields)

    But it captures the last sort order used when the user closes it and defaults to that sort order the next time the form is opened.

    I see that in Access 2007 there is a form property called "Order By On Last" but it does not exist in Access 2003.



    Thanks for your help.

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,912
    What line of code do you use to close that form?
    (RG for short) aka Allan Bunch Previous MS Access MVP - WinXP Pro, Win7 Pro Win10 Pro - acXP, ac07, ac10, ac13
    How to mark the thread as Solved!
    Teaching is not filling a bucket but lighting a fire.
    Borrowed quote..."Docendo discimus"

  3. #3
    Rick West is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Jul 2009
    Posts
    90
    The On Close Event is blank.

    The users close the form with the "X" in the upper RH corner of the form. Not sure what code is behind it.

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,912
    Hmmm...I was trying to determine why the form was saving a sort order applied by a user. DoCmd.Close acForm, Me.name, acSaveYes would do it. You can clear the sort order in the Open event if you want. I would still look around for why the sort order is being saved.
    (RG for short) aka Allan Bunch Previous MS Access MVP - WinXP Pro, Win7 Pro Win10 Pro - acXP, ac07, ac10, ac13
    How to mark the thread as Solved!
    Teaching is not filling a bucket but lighting a fire.
    Borrowed quote..."Docendo discimus"

  5. #5
    Rick West is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Jul 2009
    Posts
    90
    Tried this in the On Close Event of the form - it did not work, even when I changed it to acSave No just to try that out as well.

    If I clear the Order By Property of the form, then the next time we open the form it sorts just like the query (this is how we want it to work every time) but after we've sorted the data several ways and close the form captures the last sort in the Order By property where it fouls up the data the next time we open the form.

    How can I send an attachment and I'll show you what it looks like?

  6. #6
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,912
    Press the Post Reply button to post and scroll down to the Manage Attachments to attach something.
    (RG for short) aka Allan Bunch Previous MS Access MVP - WinXP Pro, Win7 Pro Win10 Pro - acXP, ac07, ac10, ac13
    How to mark the thread as Solved!
    Teaching is not filling a bucket but lighting a fire.
    Borrowed quote..."Docendo discimus"

  7. #7
    Rick West is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Jul 2009
    Posts
    90
    I was going to attach a screen shot of the properties window showing how the last sort style filled in but the attachments area will not allow that. I'll have to see if someone around here can turn it into a pdf or some other acceptable file.

  8. #8
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,912
    Why not just clear the OrderBy property in the Open Event of the form?
    (RG for short) aka Allan Bunch Previous MS Access MVP - WinXP Pro, Win7 Pro Win10 Pro - acXP, ac07, ac10, ac13
    How to mark the thread as Solved!
    Teaching is not filling a bucket but lighting a fire.
    Borrowed quote..."Docendo discimus"

  9. #9
    Rick West is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Jul 2009
    Posts
    90
    I'm not really sure how to do that but with your help maybe I can get it!

  10. #10
    Rick West is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Jul 2009
    Posts
    90
    Got it!

    I put Me.OrderBy = " " in the Open and in the Close event of the form and now it works as it should, by using the query to sort the records, thanks for sticking with me on this issue.

  11. #11
    Rick West is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Jul 2009
    Posts
    90
    This is embarrassing, but how do I flag my post as resolved?

    I cannot find it.

  12. #12
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,912
    Looks like you have everything resolved. Great!
    (RG for short) aka Allan Bunch Previous MS Access MVP - WinXP Pro, Win7 Pro Win10 Pro - acXP, ac07, ac10, ac13
    How to mark the thread as Solved!
    Teaching is not filling a bucket but lighting a fire.
    Borrowed quote..."Docendo discimus"

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

Similar Threads

  1. Access 2003 Query Help?
    By Stirling Steve in forum Queries
    Replies: 1
    Last Post: 08-26-2009, 03:25 AM
  2. converting from Access 2003 to Access 2007
    By LawrenceLau in forum Access
    Replies: 6
    Last Post: 11-20-2008, 03:53 PM
  3. Replies: 1
    Last Post: 08-10-2008, 01:09 AM
  4. Replies: 1
    Last Post: 09-06-2006, 11:48 AM
  5. CallTicketID populated to Order Form
    By EisBlade in forum Forms
    Replies: 0
    Last Post: 04-03-2006, 10:50 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 - Senior Forums