stop subform datasheet from scrolling to next record!

adams937

Registered User.
Local time
Yesterday, 22:47
Joined
May 16, 2011
Messages
10
This seems so simple, but I can't find the setting I'm looking for....

I have a subform that is displayed in datasheet view. When using the form, it's common to scroll through the columns using the arrow keys until reaching the desired column. If you scroll too fast and reach the end of a record, access will continue scrolling at the beginning of the next record.

Is there a way to set the datasheet view to stop scrolling when it reaches the end of a record? I'm hoping to make the interface feel more like excel.

Thanks!
 
In the On Lost Focus event of the last field of your datasheet put the following code;
Code:
Me.YourFirstFieldName.SetFocus
Caveat Emptor; this code will send the cursor back to the first field in that row when ever the last field looses focus.
 
I have tried to do this but it doesn't work. My code on the lostfocus event is
Code:
Private Sub other_LostFocus()

Me.alt_id.SetFocus

End Sub
 
If you simply want to restrict the user to the current record, then set the Cycle property to Current Record

The following code will prevent the user from tabbing into a new record if you put it in the On Lost Focus event of the control that is the last Tab Stop for your form;
Code:
With Recordset
    If .AbsolutePosition = .RecordCount - 1 Then
         DoCmd.GoToRecord acDataForm, "YourFormName", acFirst
         Me.YourControlName.SetFocus
    End If
End With
 

Users who are viewing this thread

Back
Top Bottom