- Open the form in Design View.
- Use the Alt+F11 key combination, or click View Code in the Tools group on the Ribbon, to open the Microsoft Visual Basic editor window.
- Paste the following code into the code window.
Private Sub Form_MouseWheel(ByVal Page As Boolean, ByVal Count As Long)
If Not Me.Dirty Then
If (Count < 0) And (Me.CurrentRecord > 1) Then
DoCmd.GoToRecord , , acPrevious
ElseIf (Count > 0) And (Me.CurrentRecord <= Me.Recordset.RecordCount) Then
DoCmd.GoToRecord , , acNext
MsgBox "The record has changed. Save the current record before moving to another record."
- Save and then open your form in Form View.
This code forces the user to save a record in which changes were made before the user scrolls to another record. One of the main reasons for the change in the scroll behavior was that users would use the mouse wheel to scroll through records and automatically and unexpectedly save their changes to their record.
Номер статьи: 2458709 — последний просмотр: 19 сент. 2011 г. — редакция: 1