Results 1 to 7 of 7
  1. #1
    Join Date
    Apr 2007
    Posts
    6

    Red face Unanswered: Continuous forms in subform - strange sorting behaviour

    Have an Address table and and Occupant table joined in a 1-to-many relationship. Have an Address form (FrmAddress) with a subform (FrmSub_Occupants which uses a continous form) displaying information about each of the occupants. Because of the nature of the occupant information, this is ordered by the record key (RecordKey) - an autonumber long integer. FrmSub_Occupants has its Order By property set to [Occupant].[RecordKey] and, when viewed as a standalone form the records are presented in order of RecordKey. However, when viewed as a subform in FrmAddress, with just the occupants of a particular address showing, the records are in descending order but with the even numbered RecordKeys listed first then the odd numbered RecordKeys ie instead of 1,2,3,4,5,6 I get 2,4,6,1,3,5.

    Have tried all sorts of mods and arrangements but so far have not been able to get to the bottom of this one. Any help would be much appreciated.

  2. #2
    Join Date
    Apr 2005
    Location
    Zagreb - Croatia
    Posts
    372
    Try this:
    On Form_current event put:

    Me.OrderByOn = True

  3. #3
    Join Date
    Apr 2007
    Posts
    6
    Many thanks for this: - it worked. Had seen reference to OrderByOn elsewhere but other discussions had indicated that once you had sorted a list of records in a form once, this switch was automatically on. I had tried this but the switch was clearly not on. I like to understand why something does what it does - do you know where I might find further info about this [feature]?

    Whatever - many thanks again.

  4. #4
    Join Date
    Apr 2005
    Location
    Zagreb - Croatia
    Posts
    372
    For more infor look at ACCESS HELP.

  5. #5
    Join Date
    Apr 2007
    Posts
    6
    I don't think you understood my question. The MS Access (2002) help states: "For all other objects [other than reports], you can set the OrderByOn property by clicking a Sort button on the toolbar". This is what I had done and, although the list had been sorted on the selected field when FrmSub_Occupants was used in standalone mode, the OrderByOn property had not been set to True for subsequent sorts when the FrmSub_Occupants was used within FrmAddress. I am looking for an explanation of why this might be so, not why the VBA option works.

  6. #6
    Join Date
    Jan 2007
    Location
    California, USA
    Posts
    520
    The Sort button on the toolbar is a User Interface "thing". That is, it works for the user interface, but does not set anything on the form in a permanent basis. It is only good for the duration of the form while it is part of the user interface. As soon as the form is closed, the user interface settings are gone. This is what Microsoft would say is "by design."

    HTH,

  7. #7
    Join Date
    Apr 2007
    Posts
    6

    Thumbs up

    Thanks -makes sense now - hadn't thought of 'session' effect. What a pity MS could not have applied themselves just a little bit more and added the few words that you used to give the necessary clarity (and while they were at it, added OrderByOn to the property sheet!).

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •