Results 1 to 12 of 12
  1. #1
    bkirsch is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Nov 2011
    Posts
    39

    Sort order of "many" in a one-many relationship

    I have a one to many relationship for customer orders. Each customer order has a date assigned to it. I have an input form/subform set up and when I enter a new "order" it is entered after the previous orders. Is there a way to set it up so that when I open my form the newest order, by date, is listed first?

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,913
    Set the ORDER BY property of the form or use ORDER BY clause in query if the form's RecordSource is a query. Use the DESC keyword.

    You still have to go to the end of the records to add a new record and it will stay there until the form is requeried.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    bkirsch is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Nov 2011
    Posts
    39
    I am trying to sort by the most recent "Start Date" I have tried to set the order property of the form but it isn't working. I've tried:


    Orderby: Tablename.Start Date DESC.....Start Date DESC.....[Start Date] DESC....


    Any suggestions?

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,913
    You are putting that string in the form's Order By property in the Properties dialog?

    Try simply: [Start Date] DESC
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    bkirsch is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Nov 2011
    Posts
    39
    Yes I am putting it in the form's order by property....[Start Date] DESC didn't work either

    I have tried [Start Date] DESC, [End Date] DESC, [Start Date], and [End Date] and the order never changes...?

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,913
    Is the RecordSource for the form a query? Show the SQL statement. Does it include an ORDER BY clause?

    I have successfully used this property.

    Do you want to provide project for analysis?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  7. #7
    bkirsch is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Nov 2011
    Posts
    39
    The record source is a table...

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,913
    The RecordSourse is direct to table and setting the Order By property, form should open with that sort. The Order By On Load property also says Yes?

    I don't see how the code you posted has any influence on this behavior.

    At this point, can't offer any more help without analyzing the project.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  9. #9
    bkirsch is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Nov 2011
    Posts
    39
    xl center database_2012-03-14_(1).zip



    I am working on "Main Form" ... "Client contracts" is the subform. Each client can have multiple contracts in "client contracts" subform. when I choose a client at the very top I want the "client contract" with the most recent "start date" to appear in the subform.

    Thanks for you help.

  10. #10
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,913
    I put [Start Date] DESC in the ORDER BY property of [client contracts] form and the contract record dated 1/1/2012 is the first record.

    I hope users have very big monitors. Forms are too big for my 17" laptop.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  11. #11
    bkirsch is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Nov 2011
    Posts
    39
    Click image for larger version. 

Name:	untitled.jpg 
Views:	5 
Size:	197.4 KB 
ID:	6763


    Attached is a screen shot of where I put [Start Date] DESC....is this the wrong property box? My form still doesn't list 1/1/12 first...?

  12. #12
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,913
    That's exactly what I did. Don't know why this would or if it is making difference but I am running your project in Access 2007 and 2010. I don't have 2003 any more.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Replies: 16
    Last Post: 07-22-2011, 09:23 AM
  2. "Group By" causes "ODBC--Call Failed" error
    By kaledev in forum Queries
    Replies: 1
    Last Post: 03-09-2011, 02:43 PM
  3. File Export "sort" issues
    By jgelpi16 in forum Programming
    Replies: 24
    Last Post: 09-15-2010, 12:14 PM
  4. Generate a List of Items from "Many" Relationship
    By Hammer Mark in forum Reports
    Replies: 0
    Last Post: 04-20-2009, 07:30 AM
  5. Can I pass "sort by" using DoCmd.OpenReport
    By alsoto in forum Reports
    Replies: 3
    Last Post: 04-16-2009, 08:11 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