Re: On Error MsgBox Not Wanted
From: Allen Browne (AllenBrowne_at_SeeSig.Invalid)
Date: 07/23/04
- Next message: Tracy: "Re: Corrupt form...or so it seems"
- Previous message: Andy: "On Error MsgBox Not Wanted"
- In reply to: Andy: "On Error MsgBox Not Wanted"
- Next in thread: Andy: "Re: On Error MsgBox Not Wanted"
- Reply: Andy: "Re: On Error MsgBox Not Wanted"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 23 Jul 2004 12:11:44 +0800
Teach the user to press Esc key to undo the entry if they want out.
If you use Form_Error, it should be limited ot DataErr 3314. Form_Error
could fire for other reasons also, e.g. related record required (3201),
invalid type (2113), duplicate index (3022), or even a network problem if
the data is on a server (3024). You cannot do that if you set the form's
OnError property to =CantBeBlank, because you can only pass the DataErr
value from inside the Form_Error procedure.
-- Allen Browne - Microsoft MVP. Perth, Western Australia. Tips for Access users - http://allenbrowne.com/tips.html Reply to group, rather than allenbrowne at mvps dot org. "Andy" <pchelp@wtcinformme.com> wrote in message news:e8ikTXGcEHA.3716@TK2MSFTNGP11.phx.gbl... > > When a user types in a required field, and then deletes the characters, and > tries to move to a different record the user gets the internal warning box: > "Index or Primary key cannot be blank". > > Created a simple procedure that works: > Private Sub Form_Error(DataErr As Integer, Response As Integer) > Response = acDataErrContinue > DoCmd.DoMenuItem acFormBar, acEdit, acUndo > End Sub > > Realized that this is helpful for many Forms. > > Want to create one Function instead of multiple Private Subs. > > Public Function CantBeBlank() > Dim DataErr As Integer > Dim Response As Integer > > Response = acDataErrContinue > DoCmd.DoMenuItem acFormBar, acEdit, acUndo > > End Function > > It called correctly =CantBeBlank() > But the internal warning box appears. > > Added: DoCmd.SetWarnings False
- Next message: Tracy: "Re: Corrupt form...or so it seems"
- Previous message: Andy: "On Error MsgBox Not Wanted"
- In reply to: Andy: "On Error MsgBox Not Wanted"
- Next in thread: Andy: "Re: On Error MsgBox Not Wanted"
- Reply: Andy: "Re: On Error MsgBox Not Wanted"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|