How to order in subforms

  • Thread starter Tazzy via AccessMonster.com
  • Start date
T

Tazzy via AccessMonster.com

Hi all,

I have a database of 200+ students. Most of their details are shown on their
main form. However I also need to show within this form the details of any
absences from placements they attend. The main table for the students has an
autonumber for the primary key as does the table for the absences. I
couldn't use either the student ID or the date in this table as the primary
key as both need to be duplicated.

I entered the absence table into the main student form as a subform and all
works well, it display all of the data that is needed. The only problem is
that the subform insists on displaying the its data in order of its primary
key, the autonumber. I would like it to be displayed in date order, but just
seem to be running around in circles with it. I did try a query with all
data from the absence table, then sorted it for the date and tried basing the
subform on that. It was entered ok, but still in order of the primary key.

Am I missing something really basic? If so, be gentle with your answers, I'm
still learning.

Thanks
 
V

Vladimír Cvajniga

Create a query for your subform and sort data in the table by date order,
eg.
qryAbsence:
SELECT Absence.* from Absence ORDER BY Absence.YourDateField.

In your subform set DataSource: qryAbsence

It should do what you need. If not... don't kill me, pls... ;-)

Vlado
 
T

Tazzy via AccessMonster.com

Hi Vladimír

Funny how when I tried that at first it didn't work, but on repeating it
worked fine. Must have missed something in the first place.

Thanks for your help.........you will survive

Tazzy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top