Browse puts records in wrong order

M

Mommio2

Hello,
I am using the following to go from my menu form to the form where you
can browse and update students' records.

Private Sub Browse_Students_Click()
On Error GoTo Browse_Students_Click_Err

DoCmd.OpenForm "Students", acNormal, "", "", , acNormal
DoCmd.Maximize
DoCmd.GoToRecord acForm, "Students", acFirst

Browse_Students_Click_Exit:
Exit Sub

I hate to admit it but I do not know what it all means! I want the
first record to be the first one in my table, which is sorted by last name.
However, it always lands on the record with the first date of entry. How
can I tell it to sort them by last name? THANKS!

Mommio2
 
E

Ed Robichaud

"acFirst" is telling it to go to the first record entered. Open your form
in design view and change its recordsource to a query of the Student table,
and set the sort order ([lastname],[firstname], [MI], etc. that you want.
-Ed
 
M

Mommio2

I forgot to mention that Date of Entry is the field that has focus when the
form opens.
 
J

John Vinson

I want the
first record to be the first one in my table, which is sorted by last name.

No. It isn't.

Tables HAVE NO ORDER. They should be viewed as unordered "heaps" of
records.

If you want the records in your form to be sorted alphabetically,
don't base the form on a Table - instead, base it on a Query with the
sort order that you want.

John W. Vinson[MVP]
 

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