Results 1 to 6 of 6
  1. #1
    edmscan is offline Competent Performer
    Windows 8 Access 2010 32bit
    Join Date
    Feb 2014

    How to force requery (sort) of subform data .. when tab on tab control selected.

    I have a SubForm on a TabControl .. and I would like to force the sort order of the data on the subform whenever I click on that particular tab.

    Right now .. I am forced to click on a button to force the sort order. I would like this automatically done .. when I click on that tab.

    I have tried to Call cmdSortByUserName_Click .. but it does not seem to like it. But I may have done it wrong.

    Subform is subNewRadiosNoTrans
    TabControl is TabCtl0
    Page is page index 4
    Button is cmdSortByUserName

    On click of the button is ..

    Me.OrderByOn = True
    Me.OrderBy = "User DESC"

    Right now .. it just stays at whatever the last sort order is (For example User Asc) .. not what I want. I want it always be to User Desc on selection of that tab. (there are several buttons that can change the sort order on the subform to allow different sort ordering as desired).

  2. #2
    ranman256's Avatar
    ranman256 is online now VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Is it too much trouble to put the cursor in the column then click the AZ button?
    it sounds like trying to make a lot of code to re-invent an existing wheel.

  3. #3
    JLCan is offline Novice
    Windows 8 Access 2007
    Join Date
    Apr 2015
    Hi EdmScan!

    There is one thing I don't understand: why do you need to set at run time the sort order???
    It seems to be unique so use the form sort property or even better the query!

    Good luck, JLCantara.
    Last edited by June7; 04-15-2015 at 04:01 PM.

  4. #4
    edmscan is offline Competent Performer
    Windows 8 Access 2010 32bit
    Join Date
    Feb 2014
    Yes .. you are right. It is pretty easy just to click on the button as needed. Just me being lazy I guess. And 99% of the time .. I never really need it to be sorted any other way.

  5. #5
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    The Great Land

    Base the form on a query that has the preferred sort criteria.

    Code sets the OrderBy property to "" and OrderByOn to False.
    How to attach file: To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  6. #6
    edmscan is offline Competent Performer
    Windows 8 Access 2010 32bit
    Join Date
    Feb 2014
    It is fine now .. the form opens with the correct data, and if I select another sort, it is only a button click to set it to how I usually want it.

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

Similar Threads

  1. requery subform in tab Control
    By raffi in forum Forms
    Replies: 2
    Last Post: 10-16-2014, 12:36 PM
  2. Force update of unbound calculated control
    By LillMcGill in forum Forms
    Replies: 7
    Last Post: 04-15-2013, 06:51 PM
  3. Replies: 1
    Last Post: 11-18-2012, 06:24 PM
  4. Replies: 1
    Last Post: 02-27-2012, 06:22 PM
  5. Subform requery after multiple records selected
    By AccessBlues in forum Forms
    Replies: 8
    Last Post: 08-04-2011, 11:03 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