M
Mark Andrews
I have an Access2007 database that has many forms.
On each form I use the Form_BeforeUpdate event to check for required data
and if something if not filled in it display a msgbox and jumps to that
control so the user can fill in the value.
Example:
Private Sub Form_BeforeUpdate(cancel as Integer)
If IsNull(Me.Descrption) then
Msgbox "you must supply a description..."
Cancel = True
Me.Description.SetFocus
Exit Sub
end if
......more error checking etc...
End Sub
I also trap for the 2169 error.
private sub Form_error(DataErr as Integer, Response As Integer)
Select case DataErr
case 2169
Response = acDataErrContinue
case Else
response = acDataErrDisplay
end select
End Sub
For most forms:
When a user fills in some data but not ALL required data and then clicks the
upper right corner close button
the beforeUpdate event is called and then the form_error event stops that
"You can't save the record at this time..." error. ALL IS GOOD
On forms with graphs
the before_update event is getting called TWICE so my msgboxs are showing
twice before the form actually closes. It's kinda annoying.
Anyone know how to tweak
Mark
On each form I use the Form_BeforeUpdate event to check for required data
and if something if not filled in it display a msgbox and jumps to that
control so the user can fill in the value.
Example:
Private Sub Form_BeforeUpdate(cancel as Integer)
If IsNull(Me.Descrption) then
Msgbox "you must supply a description..."
Cancel = True
Me.Description.SetFocus
Exit Sub
end if
......more error checking etc...
End Sub
I also trap for the 2169 error.
private sub Form_error(DataErr as Integer, Response As Integer)
Select case DataErr
case 2169
Response = acDataErrContinue
case Else
response = acDataErrDisplay
end select
End Sub
For most forms:
When a user fills in some data but not ALL required data and then clicks the
upper right corner close button
the beforeUpdate event is called and then the form_error event stops that
"You can't save the record at this time..." error. ALL IS GOOD
On forms with graphs
the before_update event is getting called TWICE so my msgboxs are showing
twice before the form actually closes. It's kinda annoying.
Anyone know how to tweak
Mark