Results 1 to 5 of 5
  1. #1
    Remster is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Sep 2010
    Posts
    317

    Sorting subform records

    Folks

    The attached database contains a main form, PersonForm, and a subform, RelationshipSubform. PersonForm is bound to PersonTable, which contains a person ID field and a name field. RelationshipSubform is bound to RelationshipTable, which contains a relationship ID field and two person ID fields. How can I get the records in RelationshipSubform to sort by person name (the visible column in the combo box) when the subform is bound to a table that doesn't contain any person name fields?



    Remster

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    make the RecordSource of the SubForm a Query that joins the tables you want and then sort on whatever field in either table.

  3. #3
    vitols is offline Novice
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Nov 2010
    Location
    Germany
    Posts
    9
    Quote Originally Posted by Remster View Post
    Folks

    The attached database contains a main form, PersonForm, and a subform, RelationshipSubform. PersonForm is bound to PersonTable, which contains a person ID field and a name field. RelationshipSubform is bound to RelationshipTable, which contains a relationship ID field and two person ID fields. How can I get the records in RelationshipSubform to sort by person name (the visible column in the combo box) when the subform is bound to a table that doesn't contain any person name fields?

    Remster
    Hi

    What about putting 'DLookUp' in a global function (ie in a module) called say MyDLookUp.
    Then using MyDLookUp in a query or table lookup.

    Vitols
    Last edited by vitols; 11-16-2010 at 02:11 PM. Reason: Incomplete

  4. #4
    Remster is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Sep 2010
    Posts
    317
    Quote Originally Posted by RuralGuy View Post
    make the RecordSource of the SubForm a Query that joins the tables you want and then sort on whatever field in either table.
    I thought it might come to that! I've followed the spirit (if not the letter) of your advice and changed the form's Record Source to ...
    SELECT Table1.Field1, ... , Table2.Field1, ... FROM Table1 INNER JOIN Table2 ON Table1.Field1=Table2.Field1
    ... which seems to work fine.

  5. #5
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    You can specify an OrderBy clause on any field in there as well.

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

Similar Threads

  1. Displaying Records & Sorting Help
    By raceware in forum Access
    Replies: 1
    Last Post: 09-29-2010, 06:35 AM
  2. Sorting records
    By Samu77 in forum Access
    Replies: 1
    Last Post: 09-13-2010, 10:40 PM
  3. Sorting Records
    By sfoot0309 in forum Reports
    Replies: 1
    Last Post: 02-05-2010, 05:50 PM
  4. Sorting records
    By BravoEcho in forum Queries
    Replies: 0
    Last Post: 06-23-2009, 04:49 AM
  5. Sorting in a subform
    By hraup in forum Forms
    Replies: 2
    Last Post: 08-29-2006, 12:35 PM

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