[AccessD] Membership File Changes

Bill Benson vbacreations at gmail.com
Fri Mar 7 23:03:57 CST 2014


For those not bored with this (probably only me) - I made a video to show
the row insertion problem after the Autonumber field resets to a negative
number then an insanely large number is used. This is probably the stupidest
most meaningless presentation of a repeatable Access error you'll ever lay
eyes on. I need to get to some serious work and stop doing this but I am
OCD.

http://www.youtube.com/watch?v=DJimlN1Zfp8

I have shortened the code a bit, as long as you have no table A or B you can
run as is. I should also mention that my former "error trapping" was
invalid. Even with errors handled, it is not a VBA error that occurs, it is
a database error. Doh! It was by using dbFailOnError argument in my .Execute
line that I was able to see the error at runtime. Apparently it does not
happen to John using Ac2003...

Function Test()
CurrentDb.Execute _
    "CREATE TABLE [A] (ID AUTOINCREMENT NOT NULL PRIMARY KEY, Field2 TEXT);"
CurrentDb.Execute _
     "CREATE TABLE [B] (ID LONG, Field2 TEXT);"
CurrentDb.Execute _
     "INSERT INTO B (ID, FIELD2) VALUES (-2147483648,'DELETEME');"
CurrentDb.Execute _
     "INSERT INTO B (ID, FIELD2) VALUES (2147483647, 'DELETEME');"
CurrentDb.Execute _
     "INSERT INTO A SELECT * FROM B;"

'NEXT LINE FAILS... SEE VIDEO FOR DEMO
'http://www.youtube.com/watch?v=DJimlN1Zfp8
CurrentDb.Execute _
     "INSERT INTO A (FIELD2) VALUES ('SomeValue');", _
     dbFailOnError

End Function



More information about the AccessD mailing list