Results 1 to 7 of 7
  1. #1
    netchie is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Aug 2010
    Posts
    92

    Unhappy How To Sort A Number Field in a Form?

    Hi,



    I have a form where data can be added and it has different tabs. The 3rd tab has idVersion field and Comment field where users can add the version and comment, if needed. When they need to add another version, the blank fields will be added as next row, so on and so forth. The problem is users are adding a lot of versions but not sorted. So for example:

    Row 1 of the form: idVersion field is "1" and comment has "Test 1".
    Row 2 of the form: idVersion field is "8" and comment has "Test 8".
    Row 3 of the form: idVersion field is "2" and comment has "Test 2".
    Row 2 of the form: idVersion field is "5" and comment has "Test 5".


    So how can I fix it where after they saved the version and comment, when they close the database and re-open it again, the data will show up as:

    Row 1 of the form: idVersion field is "1" and comment has "Test 1".
    Row 2 of the form: idVersion field is "2" and comment has "Test 2".
    Row 3 of the form: idVersion field is "5" and comment has "Test 5".
    Row 2 of the form: idVersion field is "8" and comment has "Test 8".


    So even if they add a new version and comment (example version "3"), it will be automatically sorted when the database is reopen.

    Thanks in advance,
    netchie

  2. #2
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    What is the record source of the form?

  3. #3
    netchie is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Aug 2010
    Posts
    92
    It is tblModelVersion

  4. #4
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    To sort (or order) records, you have to use a query. Tables are just "bit buckets".
    Create a query (qryModelVersion), add the fields, select which field(s) you want to sort by, save it, then change the form record source to the name of the query. All controls should stay bound to the field.
    The order of the fields in the query doesn't matter - if you have multiple field to sort by, you can rearrange them to get the fields in the order you want.

  5. #5
    netchie is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Aug 2010
    Posts
    92
    Ok, I already created a query for it and drag all necessary fields that I need. I changed the Control Source to the new qry that I created. I checked it out but some are still not sorted. Well, actually, I created a query and use it that's all and did not do anything on how to show that it's sorted. So how can it be sorted?

  6. #6
    netchie is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Aug 2010
    Posts
    92
    I put "Ascending" in Sort and it worked!

    Thanks ssanfu!

  7. #7
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    You are welcome

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

Similar Threads

  1. Button to Sort by Field
    By tylerg11 in forum Programming
    Replies: 4
    Last Post: 10-20-2011, 02:43 PM
  2. form with variable field number
    By FRSPA in forum Access
    Replies: 10
    Last Post: 05-04-2011, 05:29 AM
  3. Replies: 3
    Last Post: 04-19-2011, 06:41 PM
  4. Sort according to field length?
    By wawinc in forum Queries
    Replies: 4
    Last Post: 12-15-2010, 04:27 PM
  5. Sort by even or odd number
    By sammer021486 in forum Queries
    Replies: 7
    Last Post: 11-23-2009, 12:30 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