Add record, immediately sort and display

  • Thread starter Thread starter Frans van Zelm
  • Start date Start date
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
 
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
 
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:
 
Back
Top