Discussion Locked

Access97 Macro

0 helpful
3 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
How can I create a macro that will go to the first control in a main form from the last control in a subform if the Enter key is pressed? If the Tab key is pressed from last control in the subform I want to cycle back to the first control to add a new record.

3 replies

by bristar

Here's a couple of thoughts:
1.) To move from the last record to the first record, change the Tab Order under the View menu. If you want to automatically create a new record when moving out from the last control, try adding a command under the "OnExit" Event that will go to EOF and add a new record, then set the focus to the first control (me.control.setfocus)

2.) If you want to automatically add a new record after hitting Enter (would work on all controls however), create a command button to add a new record, change its Visible property to false and its Default value to True. It will be activated anytime Enter is pressed instead of Tab.

This discussion is closed to new replies.