I have a form with some controls that are bound to the database, a Save button, and a subform. If the user makes any changes to the controls on the form, I don't want them to be able to save those changes without clicking on the Save button. Since the controls are bound, I have a BeforeUpdate event called by my Save button to evaluate what's on the form.
The problem is that if the user clicks on the subform, the BeforeUpdate event runs, and I only want updates by clicking the Save button. I tried:
Private Sub Form_BeforeUpdate(Cancel As Integer)
' If the user has clicked on one of the subforms (ie. the form loses focus),
' then don't update. Only update if the user's clicked on the Save button.
If Form.LostFocus Then
DoCmd.CancelEvent
Else
(Code to evaluate what's on the form)
End If
, but the compiler won't let me use Form.LostFocus. Does anyone have any ideas, either with what's wrong with this code, or other ideas of their own?
Thanks,
Steve Geller
The problem is that if the user clicks on the subform, the BeforeUpdate event runs, and I only want updates by clicking the Save button. I tried:
Private Sub Form_BeforeUpdate(Cancel As Integer)
' If the user has clicked on one of the subforms (ie. the form loses focus),
' then don't update. Only update if the user's clicked on the Save button.
If Form.LostFocus Then
DoCmd.CancelEvent
Else
(Code to evaluate what's on the form)
End If
, but the compiler won't let me use Form.LostFocus. Does anyone have any ideas, either with what's wrong with this code, or other ideas of their own?
Thanks,
Steve Geller