Kamis, 26 November 2015

Re: [MS_AccessPros] Sorting question

 

Steve-

Use the form's AfterUpdate and AfterInsert events to Requery the form. That should put the records back in sequence and put the focus on the first row.

John Viescas

Sent from my iPad

On Nov 26, 2015, at 11:35, Steve5 thaw5@suddenlink.net [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:

I have a form which I created using the Split Form tool on the Forms
section of the ribbon's Create tab. The form's data source is a query.
The datasheet view at the bottom of the screen has room to display about
a dozen records. Each record has a line number field, iLineNr. When the
form opens, the records are sorted by iLineNr based on the ORDER BY part
of the query.

When the user enters data into or changes data in the iLineNr field, I'd
like to resort the records displayed in the form's datasheet by iLineNr
ascending. I think the iLineNr LostFocus event is the place to do the
sorting. Some internet sites suggested using a recordset and this line
of code but I haven't been able to get it to work: Set rstSortByLineNr =
dbSortByLineNr.OpenRecordset("query", dbOpenDynaset) where for "query" I
have the form's data source query.

Is this the way to go about the sort? Is there a better way? Thanks.

Steve

------------------------------------
Posted by: Steve5 <thaw5@suddenlink.net>
------------------------------------

------------------------------------

Yahoo Groups Links

__._,_.___

Posted by: John Viescas <johnv@msn.com>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (10)

.

__,_._,___

Tidak ada komentar:

Posting Komentar