I am using MS Access 2010 and trying to do everything in Macros.
I have a form (frmPt) that must have data in several fields. On the BeforeUpdate event I run this macro:
If I am entering records it works great.
However, there is a "close" button on the form. If the button is pushed it does not run any of the beforeupdate.
I tried placing all of this code on the OnClick event of the button adding quit method (see below).
It would run the checking of the data but will not Quit Access.
Any advice or wisdom would be greatly appreciated.
Thank you!
I have a form (frmPt) that must have data in several fields. On the BeforeUpdate event I run this macro:
Code:
If Null([txtMRN]) And [Dirty] then MessageBox GoToControl txtMRN Elseif isNull(cboProviderName) and [Dirty] then Messagebox GoToControl cboProviderName ElseIf isnull(opgEvalType) and [Dirty] then MessageBox GotoControl opgEvalType ElseIf isnull(opgHowLate) and [Dirty] then MessageBox GoToControl opgHowLate Elseif isnull(opgReason) and [Dirty] then MessageBox GotoControl opgReason Elseif cbkReschedule = True If isnull(opgRWhen) then Msgbox GoToControl opgRWhen Elseif isnull(opgRPro) then Msgbox Gotocontrol opgRPro End if End if
However, there is a "close" button on the form. If the button is pushed it does not run any of the beforeupdate.
I tried placing all of this code on the OnClick event of the button adding quit method (see below).
Code:
If Null([txtMRN]) And [Dirty] then MessageBox GoToControl txtMRN Elseif isNull(cboProviderName) and [Dirty] then Messagebox GoToControl cboProviderName ElseIf isnull(opgEvalType) and [Dirty] then MessageBox GotoControl opgEvalType ElseIf isnull(opgHowLate) and [Dirty] then MessageBox GoToControl opgHowLate Elseif isnull(opgReason) and [Dirty] then MessageBox GotoControl opgReason Elseif cbkReschedule = True If isnull(opgRWhen) then Msgbox GoToControl opgRWhen Elseif isnull(opgRPro) then Msgbox Gotocontrol opgRPro End if Else Docmd Quit End if
Any advice or wisdom would be greatly appreciated.
Thank you!
Comment