Add record, immediately sort and display

F

Frans van Zelm

Thanks for your help!

This must have be done before.

After finishing a new record in a form, I want it to be shown in the default
sort order. So:
a - d - e - f -[*]
^ this is the new record
you type 'c' and save
a -[c]- d - e - f
^ record viewed in form

Thanks again, Frans van Zelm
 
P

Peter Dave

Assuming you have set the query that your form is based on to be sorted by the appropriate field... all you need to do is have the following in your code
Private Sub Form_AfterInsert(
Me.Requer
End Su
 
F

Frans van Zelm

Hi Peter Dave,

I had already tried Requery, Repaint, Refresh. I even fought
with bookmarks of the recordset/clone. It puzzles me.

With me, Requery shows the first record after saving the new record.
The new record is 'in place' though.

The real situation is a bit more complicated.
1) Most forms are based on tables. I don't know if that matters. To me,
it looks there is no difference.
2) The sorting order of the form must sometimes be different
from the underlying table/query, so set by code or something.
I did it 'my way':
Private Sub Form_Open(Cancel As Integer)
Me.OrderBy = "tblTest.teName"
Me.OrderByOn = True
End Sub

Thanks for your reaction anyway. But still, if you know something ...
By the way: I use the Dutch version of Access 2K. Is that the problem?

Frans

Peter Dave said:
Assuming you have set the query that your form is based on to be sorted by
the appropriate field... all you need to do is have the following in your
code:
 

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