The Stoat
The Grim Squeaker
- Local time
- Today, 19:50
- Joined
- May 26, 2004
- Messages
- 239
Hi all,
I'm trying to put some error handling events in my DB mainly to deal with key violations when appending records to tables.
I've put this in a module which is called when i need to run a query.
However when i do an append query that i know generates a key violation i am not getting an error generated. I would like to tell the user that they have already appended the record(s). If i remove the DoCmd.SetWarnings I get all of the access default append messages which i don't want.
Any clues?
Cheers
TS
I'm trying to put some error handling events in my DB mainly to deal with key violations when appending records to tables.
I've put this in a module which is called when i need to run a query.
Code:
Option Compare Database
Option Explicit
Public Function RunQry(QryName As String)' Pass in name of saved query
On Error GoTo ErrHandle
DoCmd.SetWarnings False
DoCmd.OpenQuery (QryName)
DoCmd.SetWarnings True
Exit Function
ErrHandle:
HandleErrors (Val(Err.Number)) 'If an error is generated it will call this function
End Function
However when i do an append query that i know generates a key violation i am not getting an error generated. I would like to tell the user that they have already appended the record(s). If i remove the DoCmd.SetWarnings I get all of the access default append messages which i don't want.
Any clues?
Cheers
TS