DoCmd.gotorecord Method

  • Thread starter Thread starter TonyB
  • Start date Start date
T

TonyB

Hi,
I'm creating navigation buttons in a form based upon a table.
To move through the records displayed in the form I'm using
DoCmd.GoToRecord , , acNext
This appears to be working, but I'm not getting the next record in the
displayed records highlighted. Is there a method of DoCmd that should do
this ? I couldn't spot anything in the help.
Thanks
Tony
 
When you go to the next record programmatically (as opposed to using the Tab
key to cycle through records), Access keeps the focus in the same box/control
where it was in the current record before the move.

Try adding another line after your GoToRecord: YourControlName.SetFocus.
YourControlName will be the name of the control you want to be highlighted.
This will force the program to move the focus to that control.

You could even put the ControlName.SetFocus in the Form_Current event if you
ALWAYS want the control to go to a specific control when moving from one
record to another.
 
Back
Top