How to automatically set cursor to first record (in subform of a tabcontrol)

ino_mart

Registered User.
Local time
Today, 01:51
Joined
Oct 7, 2009
Messages
78
All

I have a form called frmMain.
This form contains a TabControl named tabMain
tabMain has some pages. One of the pages is called pagRecords
pagRecords contains a subform called frmRecords.
frmRecords contains records from an in-memory table.

My problem:
If I select tab pagRecords the cursor is set to the last record.

What I want: as soon I select tab pagRecords, the record cursor must always be set to the first record.

I think this can be done with next code.
Code:
DoCmd.GoToRecord acActiveDataObject, , acFirst
However, I placed this line in a lot of event properties but it is never triggered (I put a break on the line).

So on which object and event should I put this line? (and is acActiveDataObject the right parameter?)

Regards
Ino
 
If code never fires, even with a break point, that means that the code never gets there.
 
Yes, that's indeed true. But I tried to place my code in the events "on open", " on load", "on activate", "on got focus", ...

I now figured out I have to put it in the "ON ENTER" event of the subform-control in which the subform is displayed.
 
Last edited:

Users who are viewing this thread

Back
Top Bottom