Ordering/Sorting Data in Form

  • Thread starter Thread starter Patrick Bullet
  • Start date Start date
P

Patrick Bullet

Guest
Hi all,
I have a simple 2-table database. the 'parent' table is tblProducts, and the 'child' table is tblDocuments. (one [products] to many [docouments] relationship)

My data entry is done using a 'documents' subform inside a 'products' parent form. The data entry works fine, except i would really like it if my products and documents would be listed in alphabetical order in their respective form/subform {makes it easier on the user, and saves me needing a find record button}. At the moment they seem to be ordered by the time in which they were added to the table. I guess Access is using the primary Key as the 'order by' parameter.

The thing that is infuriating me is that i have gone into my two tables and told access to sort the data by Product Name, and Document name in the respective tables. I can verify that this has worked by going to data view; lo and behold the data are listed in the order i specified.

Further I have gone into my form and sub form properties, into the Data...Order By property and have keyed in the name of the field i want to sort by (product name in the parent form, and document name in the sub form).

I have tried all combinations and permutations of the above processes but nothing seems to work.

It seems i am missing one crucial piece to the puzzle, as i haven't had much luck finding a solution on groups.google or anything else (maybe im using the wrong search terms). I am having this problem with all of my databases, so any help would be appreciated.

Thanks in advance.
 
Sounds like you have based your forms on your tables instead of basing them on queries. A rather common mistake.

Basically just make a new query in design view and add tblProducts to it. This is the only table needed. Then add all the fields from the table to the query. Put the sort order on the field that you want. Then save the query.

Go to the form and change its RecordSource to the query. That should sort the form the way you wanted it.

Once you have that working then do the same thing for the sub form.
 
That works a treat!

You have no idea how much computer nerd rage you have just saved me from!

Just for curiosity's sake, does anyone know why access needs to use an ordered query rather than an ordered table to do this, or is it just one of those things Access 'just does'?

Thanks again.
 

Users who are viewing this thread

Back
Top Bottom