|
-
January 17th, 2000, 01:51 PM
#1
ADO Duplicate Key
I am a novice using VB6....
I have an ACCESS database setup and a form that updates the database. I am looking for soke example code that will help me trap a "duplicate key" error and format the error in a readable format (other than what is normally returned )...
Thnak you in advance...
-
March 24th, 2000, 04:14 AM
#2
Re: ADO Duplicate Key
put this in the sub where the error occurs
'put this at the top
on error goto ADOerror
'you can write here the rest of the code
exit sub
:ADOerror
if err.number = 'put here the number that the error returns
msgbox "Duplicate key in table" & vbcrlf & err.description, vbokonly, "error " & err.number
end if
-
March 24th, 2000, 11:34 AM
#3
Re: ADO Duplicate Key
I think this only works when you save your recordset, not with immediate effect
as your control losts its focus.
-
March 24th, 2000, 12:14 PM
#4
Re: ADO Duplicate Key
You can write a quick SQL Statement to test the value they enter though. do a select statement with the where clause value equal to the value the user entered. if you get something back, then it's a dupliate, if not, then it's okay.
John
John Pirkey
MCSD
www.ShallowWaterSystems.com
John Pirkey
MCSD (VB6)
http://www.stlvbug.org
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|