When you move focus from a parent form to a subform the parent form's current
record is updated. This is necessary because a subform commonly is based on
a table which references the parent form's table in a many-to-one
relationship. Consequently if the parent form's record was not updated
referential integrity could be violated by adding a new record in the subform.
What you are asking for is therefore paradoxical, as to enable the subform's
data to be edited while at the same time allowing the parent form to be
updated only via a 'Save Record' button means that the only way the subform's
data can be edited would be to save the parent form's current record with the
button. This is a situation where you can't have your cake and eat it I'm as
far as I can see, apart from disabling the mouse wheel using one of the
methods in the links I gave you.
The only possible solution which springs to mind would be to monitor the
cursor position via regular calls to the Windows API in the parent form's
Timer event procedure, and update the parent form's record if the cursor is
over the subform. I would not recommend this however as it would only need
the user to move the mouse over the subform momentarily to inadvertently save
the parent form's record, which would undermine the benefits of saving only
via the button. Should you wish to try it, however, the following module
includes a GrabCursor procedure which assigns the values of the cursor
coordinates to two public:
Option Compare Database
Option Explicit
Type POINTAPI
X As Long
Y As Long
End Type
Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Declare Function SetCursorPos Lib "user32" (ByVal X As Long, ByVal Y As
Long) As Long
Public lngCursorX As Long, lngCursorY As Long
Public Sub GrabCursor()
Dim dl As Long
Dim pt As POINTAPI
dl = GetCursorPos(pt)
lngCursorX = pt.X
lngCursorY = pt.Y
End Sub
Public Sub RestoreCursor()
SetCursorPos lngCursorX, lngCursorY
End Sub
Ken Sheridan
Stafford, England