Form Sorting

  • Thread starter Thread starter Buck Naked
  • Start date Start date
B

Buck Naked

I have a database that contains a few tables, this one query centers around
two of them, students and attendance.

I have a primary key on student ID (autonumber) and this field coincides
with the ID field in attendance, which is also a primay key and the
relationship is one to many. I've made a query that selects all of the
students from the student table and then lists their attendance. I've
applied an order to the query to go by student name ascending and then by
date (in attendance) descending. The query looks exactly like I'd expect it
to.

I then took the query and built a Form for it, using the wizard. The
problem is that the query is displaying the students by their student ID and
the dates appear to be somewhat random.

Any idea on why the Form differs from the query? I'd expect the form to
show the information in the exact same order as the query. Any and all in
sight would be most appreicated.
 
Check the OrderBy property on the Data tab of the Form's Properties sheet when the form is
open in Design View to see if the wizard placed something there.
 
Thanks for the reply.

There wasn't anything placed in there, so I went ahead and opened the form I
wanted sorted by name. I added name, and no change. I then changed it to
student.name, and still no change. Anything special that needs to be done?

I hate sounding obtuse, but I'm not sure what to do next.
 
By chance do the query and table have the same name and you accidentally selected the
wrong one? The table would be unsorted and, if new, may actually appear to be close to
being sorted on the autonumber field.
 
You can't name a query and the table the same title (at least not in Office
XP).

Though I guess you could name the form and the query the same, but since
this form also contains a subform and I made changes to both, I know I
opened the correct one (just double checked for the hell of it).
 
You're correct, but if they were close it could still be easy to miss.

If the Sort property is blank then the only other thing I can think of is that there is
code running when the form opens that changes the sort order. Is there anything in the
OnOpen, OnLoad, OnActivate, or OnCurrent events?
 
Back
Top