Results 1 to 7 of 7
  1. #1
    Access_Novice is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Sep 2013
    Posts
    265

    Why is my form opening in alphabetical order?

    In the attached database, I am working with the table called "Parents" and the form called "Parents."



    The table is sorted by parentID (an AutoNumber which is formatted as '000') so I presume the first record would be parentID 001 which corresponds with Dolores Burke.

    However, when I open the 'Parent' form, record 1 of 57 is not Dolores Burke. Instead it is Donnell Arnold with a parent ID of 025. Why is this the case? At one point I did sort by lastname but I have since removed that sort. The table is now sorted by the primary key which is ParentID.



    Also, how can I get the form to open to a particular record?
    Attached Files Attached Files

  2. #2
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,441
    set the sort order of the form to whatever field(s) you want. If you don't define it you're going to get inconsistent results, and if you haven't changed the sort from the way you originally had it it's going to continue sorting them in the 'old' order until you change it.

    In your case you have, in the ORDER BY property of your form

    [Parent].[LastName] change that to [Parent].[ParentID] and you're set to go

  3. #3
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Don't rely on autonumber ID to coincide with the record number on form. Autonumber sequence can have gaps (aborted data entry) and autonumber doesn't even guarantee it will be a positive value, although I've never seen negative generated.

    Opening to a particular record and still have all other records available for navigating will require code.
    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.

  4. #4
    Access_Novice is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Sep 2013
    Posts
    265
    Quote Originally Posted by rpeare View Post
    set the sort order of the form to whatever field(s) you want. If you don't define it you're going to get inconsistent results, and if you haven't changed the sort from the way you originally had it it's going to continue sorting them in the 'old' order until you change it.

    In your case you have, in the ORDER BY property of your form

    [Parent].[LastName] change that to [Parent].[ParentID] and you're set to go
    That was it. Thank you very much.

  5. #5
    Access_Novice is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Sep 2013
    Posts
    265
    Quote Originally Posted by June7 View Post
    Don't rely on autonumber ID to coincide with the record number on form. Autonumber sequence can have gaps (aborted data entry) and autonumber doesn't even guarantee it will be a positive value, although I've never seen negative generated.

    Opening to a particular record and still have all other records available for navigating will require code.
    Good point about the AutoNumber. Thank you sir.

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Recent thread on topic of opening form to specific record https://www.accessforums.net/program...ord-40003.html
    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
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    The table is sorted by parentID
    Just wanted to point out that tables can not be "sorted" or have an inherent sort order. A table is a "bit bucket". Records are usually displayed in the order entered.... but that is not always the case. Don't rely on a table to have any type of order.

    My rule of thumb is to use a query as the record source for a form. That way you can always set/control the sort order.

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

Similar Threads

  1. Records are not in alphabetical order
    By snowboarder234 in forum Forms
    Replies: 3
    Last Post: 04-12-2012, 03:30 PM
  2. Non-alphabetical Group
    By EricF in forum Reports
    Replies: 3
    Last Post: 08-26-2011, 12:04 PM
  3. Combo Box in Alphabetical order
    By jordanturner in forum Forms
    Replies: 2
    Last Post: 09-24-2010, 08:02 AM
  4. Replies: 6
    Last Post: 05-11-2010, 02:22 PM
  5. omit word in entry for alphabetical order
    By airhud86 in forum Access
    Replies: 1
    Last Post: 12-14-2009, 03:49 PM

Tags for this Thread

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