Results 1 to 5 of 5
  1. #1
    Join Date
    Jan 2013
    Posts
    9

    Question Unanswered: Custom Ordering of Form Info

    I've created a database for a bunch of teachers to create their lesson plans in, but when I made it, it was mid way through the semester when they started working with the database. So most of the teacher's first record when they open up their form is like week 8 class 4 and I want the first record to pop up be whatever class is their closes to week 1 class 1. I have uploaded an example of one of the databases that I built and is currently being used by one of the teachers with the problem I have mentioned. I'm still fairly new to Access so any help regarding this or any ideas to make it better would be greatly welcomed.
    Attached Files Attached Files

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    This isnt' really a major issue
    all it means is that the form is sorting according to the primary key order, Im guessing you are using an autonumber for the proimary key. so to fix that you'd be best change the sort order on the form so that it appears in date/class order.
    open the form in design mode
    select the square to the left of the horizontal ruler, so that it has a small black square inside
    then press the f4 key to show the properties (if they are not already showing).
    change the order by to be the columns you need. and that will depend on the table design
    if the table is called say classes and the columns are called DateOfClass and ClassNo then change the order by property to be:-
    [classes].[dateofclass],[classes].[ClassNo]

    the 'proper' fix would be to redesign the table so that you got rid of the autonumber primary key and instead defined the primary key as the week and class id's. one of the advantages of doing this is that then your users cannot defined multiple rows for the same week and class id
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    Jan 2013
    Posts
    9
    Thanks for the idea. I think I'm going to have to go through and recreate the database from scratch.There is stuff I have been wanting to add in but haven't had a decent enough reason to do so. My only question is that since Primary Keys can't be duplicated, if I make both the Week and Class fields Primary Keys wouldn't I run into a problem when there is say a Week 1 Class 2 and a Week 3 Class 2?

  4. #4
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    Not if your primary key is a composite, made up of more than one column.
    The primary key must be unique, there must be no duplicates.
    Sometimes its appropriate to use an autonumber. Usually thats when there are no or multiple candidates for the pk. Another is for performance reasons or simplification if there are many columns making up the pk.
    Generally its not a smart call to use a column in a pk that is liable to change.
    I'd rather be riding on the Tiger 800 or the Norton

  5. #5
    Join Date
    Jan 2013
    Posts
    9

    Thanks

    Thanks for the help. The database now works great.

Posting Permissions

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