[AccessD] Membership File Changes

Bill Benson bensonforums at gmail.com
Fri Mar 7 11:02:40 CST 2014


OK, this discussion has intrigued me like few others. I have found a fun and
free way to corrupt my database. Play along boys and girls and I am sure it
will be fun for you too. In the below example, B is used as a temp table to
hold a couple of values for the fun and exciting purpose of destroying A's
usefulness.

CurrentDb.Execute "DROP TABLE [A];"
CurrentDb.Execute "DROP TABLE [B];"
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;"
CurrentDb.Execute "DELETE FROM [A] WHERE ID =2147483647;"
CurrentDb.Execute "DROP TABLE [B];"

This leaves a single record in table A with ID = -2147483648

Now try and add a new record to A and you will find you cannot. Why doesn't
it autoincrement to -2147483647 ? That is a very good question. Let's now
delete the one record remaining and try again:

          CurrentDb.Execute "DELETE FROM [A] WHERE ID =2147483648;"

Or alternatively
          CurrentDb.Execute "DELETE * FROM [A];"

Now add a new record and you will see that the database begins a new record
at ID = -2147483647!!!!

DEFIES ALL LOGIC! It has been my pleasure to baffle you!



More information about the AccessD mailing list