Microsoft Access key field
-
Topic author - Site Admin
- Posts in topic: 3
- Posts: 17787
- Joined: Wed Dec 22, 2004 9:31 pm
- Location: Friendswood, TX
- Contact:
Microsoft Access key field
Is there a way to reset an Access auto-generated primary key field to "0?" While setting up a database and doing testing, the primary key field has advanced and I need it reset, if at all possible.
Thanks,
Chas.
Thanks,
Chas.
Re: Microsoft Access key field
Here is the procedure for resetting and autonumber field in access: http://support.microsoft.com/kb/812718" onclick="window.open(this.href);return false;
-
- Senior Member
- Posts in topic: 3
- Posts: 2296
- Joined: Mon Apr 20, 2009 8:49 pm
- Location: North Ft Worth(Alliance area)
Re: Microsoft Access key field
I thought you could just do a TRUNCATE TABLE "tablename" in a SQL window.
21-Apr-09 filed online
05-Sep-09 Plastic Arrived
09-Sep-13 Plastic Arrived
21-june-18 Plasic Arrived
05-Sep-09 Plastic Arrived
09-Sep-13 Plastic Arrived
21-june-18 Plasic Arrived
Re: Microsoft Access key field
That will delete all the data in the table.suthdj wrote:I thought you could just do a TRUNCATE TABLE "tablename" in a SQL window.
-
- Senior Member
- Posts in topic: 2
- Posts: 728
- Joined: Sat Nov 21, 2009 9:01 pm
- Location: Brazoria County
Re: Microsoft Access key field
Yes, one has to be careful with SQL calls to MS Access, since it uses non-standard SQL (MS has done this kind of thing regularly) -- one of the reasons I dumped it years ago. Access is actually only a front-end to a non-standard back-end file.dalto wrote:That will delete all the data in the table.suthdj wrote:I thought you could just do a TRUNCATE TABLE "tablename" in a SQL window.
Life is for learning.
IANAL, thank gosh!
NRA Life Member - TSRA - PSC
NRA Certified Basic Rifle Instructor, Chief Range Safety Officer
12/23/2009: Packets delivered.
01/15/2010: Plastic in hand!
IANAL, thank gosh!
NRA Life Member - TSRA - PSC
NRA Certified Basic Rifle Instructor, Chief Range Safety Officer
12/23/2009: Packets delivered.
01/15/2010: Plastic in hand!
-
- Senior Member
- Posts in topic: 2
- Posts: 3032
- Joined: Thu May 01, 2008 10:12 am
- Location: Northern Colorado
Re: Microsoft Access key field
OldSchool wrote:Yes, one has to be careful with SQL calls to MS Access, since it uses non-standard SQL (MS has done this kind of thing regularly) -- one of the reasons I dumped it years ago. Access is actually only a front-end to a non-standard back-end file.dalto wrote:That will delete all the data in the table.suthdj wrote:I thought you could just do a TRUNCATE TABLE "tablename" in a SQL window.
![I Agree :iagree:](./images/smilies/iagree.gif)
Be very careful with TSQL statement in Access. It uses the JET DB engine and even with literals and like strings, the syntax is different.
Charles - Some of the previous links cover it, but just wanted to throw my vote in for SQL Express. It's free and very easy to use. Might want to give that a look.
![tiphat :tiphat:](./images/smilies/tiphat.gif)
*NRA Endowment Member* | Veteran
Vote Adam Kraut for the NRA Board of Directors - http://www.adamkraut.com/
Vote Adam Kraut for the NRA Board of Directors - http://www.adamkraut.com/
-
- Senior Member
- Posts in topic: 2
- Posts: 728
- Joined: Sat Nov 21, 2009 9:01 pm
- Location: Brazoria County
Re: Microsoft Access key field
True, it's never too soon to plan on converting to another database, even if you think it's years away. Anything can happen to the database engine you're using now, and Access has many built-in limitations that eventually show up.pbwalker wrote:OldSchool wrote:Yes, one has to be careful with SQL calls to MS Access, since it uses non-standard SQL (MS has done this kind of thing regularly) -- one of the reasons I dumped it years ago. Access is actually only a front-end to a non-standard back-end file.dalto wrote:That will delete all the data in the table.suthdj wrote:I thought you could just do a TRUNCATE TABLE "tablename" in a SQL window.![]()
Be very careful with TSQL statement in Access. It uses the JET DB engine and even with literals and like strings, the syntax is different.
Charles - Some of the previous links cover it, but just wanted to throw my vote in for SQL Express. It's free and very easy to use. Might want to give that a look.
Just recently made a project of converting a large MS Access database (that I inherited) because Access was dying due to the file size (6MB, even though it's advertised to handle hundreds of times larger than that), and our IT group had decided to "upgrade" to the new Office version (which is always a disaster, and never entirely backwards compatible).
Decided on SQLite, since that also uses a single-file database (very portable), is free (no seat licenses), and very reliable (this was an important database for my work).
ETA: Oh, yeah, almost forgot: It uses standard SQL with some extensions.
Ended up, after doing significant research, that the easiest way to do it was to convert the Access file to MS Excel, then to CSV, then imported into SQLite using one of the many tools out there. While the way I did it took a long time to complete, I am thoroughly pleased with the results (which I use every day)!
Life is for learning.
IANAL, thank gosh!
NRA Life Member - TSRA - PSC
NRA Certified Basic Rifle Instructor, Chief Range Safety Officer
12/23/2009: Packets delivered.
01/15/2010: Plastic in hand!
IANAL, thank gosh!
NRA Life Member - TSRA - PSC
NRA Certified Basic Rifle Instructor, Chief Range Safety Officer
12/23/2009: Packets delivered.
01/15/2010: Plastic in hand!
-
Topic author - Site Admin
- Posts in topic: 3
- Posts: 17787
- Joined: Wed Dec 22, 2004 9:31 pm
- Location: Friendswood, TX
- Contact:
Re: Microsoft Access key field
Thanks for the input guys. My web host includes MySQL; is that an option as well?
Chas.
Chas.
Re: Microsoft Access key field
Absolutely, but one thing to consider is how you are using access. Most of the things mentioned including mysql are database backends. If you are using Access to develop forms or software you would need to find another way to do that.Charles L. Cotton wrote:Thanks for the input guys. My web host includes MySQL; is that an option as well?
Chas.
It really depends what you are trying to accomplish and what skills and time you have to bring to the table.
-
- Senior Member
- Posts in topic: 2
- Posts: 3032
- Joined: Thu May 01, 2008 10:12 am
- Location: Northern Colorado
Re: Microsoft Access key field
100%. It's my favorite platform, hands down! (I only recommended SQL Express because it's MS and I figured there would be some migration tool)Charles L. Cotton wrote:Thanks for the input guys. My web host includes MySQL; is that an option as well?
Chas.
MySQL provides great documentation, how-to's, and wikis. It was an easy transition for me (from SQL 2000).
http://dev.mysql.com/tech-resources/art ... osoft.html
Dalto is right though...MySQL can do a lot of stuff, but it is really a command line DB. It all depends on what you need. There are front end GUI's, but I haven't used any to make a recommendation. If you are using a lot of the GUI builders in MS Access, you may find MySQL to be too much of a hassle. Then again, there may be some nice open source tools that can do this...
*NRA Endowment Member* | Veteran
Vote Adam Kraut for the NRA Board of Directors - http://www.adamkraut.com/
Vote Adam Kraut for the NRA Board of Directors - http://www.adamkraut.com/
-
- Senior Member
- Posts in topic: 3
- Posts: 2296
- Joined: Mon Apr 20, 2009 8:49 pm
- Location: North Ft Worth(Alliance area)
Re: Microsoft Access key field
Yes but since it is test data it should not matter. If it is not test data then resetting could lead to other issues.dalto wrote:That will delete all the data in the table.suthdj wrote:I thought you could just do a TRUNCATE TABLE "tablename" in a SQL window.
21-Apr-09 filed online
05-Sep-09 Plastic Arrived
09-Sep-13 Plastic Arrived
21-june-18 Plasic Arrived
05-Sep-09 Plastic Arrived
09-Sep-13 Plastic Arrived
21-june-18 Plasic Arrived
-
Topic author - Site Admin
- Posts in topic: 3
- Posts: 17787
- Joined: Wed Dec 22, 2004 9:31 pm
- Location: Friendswood, TX
- Contact:
Re: Microsoft Access key field
One of the tables contains only test data, but others have live data and a lot of queries and forums have been created. If I can delete all the test data in one table and reset the auto number at the same time, then that's fine.suthdj wrote:Yes but since it is test data it should not matter. If it is not test data then resetting could lead to other issues.dalto wrote:That will delete all the data in the table.suthdj wrote:I thought you could just do a TRUNCATE TABLE "tablename" in a SQL window.
Thanks,
Chas.
-
- Senior Member
- Posts in topic: 3
- Posts: 2296
- Joined: Mon Apr 20, 2009 8:49 pm
- Location: North Ft Worth(Alliance area)
Re: Microsoft Access key field
Like dalto said it will wipe out the data in that table and reset the auto number, however if any other tables is referencing the data in that table then you might get some broken records. It all depends on how it is all connected.Charles L. Cotton wrote:One of the tables contains only test data, but others have live data and a lot of queries and forums have been created. If I can delete all the test data in one table and reset the auto number at the same time, then that's fine.suthdj wrote:Yes but since it is test data it should not matter. If it is not test data then resetting could lead to other issues.dalto wrote:That will delete all the data in the table.suthdj wrote:I thought you could just do a TRUNCATE TABLE "tablename" in a SQL window.
Thanks,
Chas.
21-Apr-09 filed online
05-Sep-09 Plastic Arrived
09-Sep-13 Plastic Arrived
21-june-18 Plasic Arrived
05-Sep-09 Plastic Arrived
09-Sep-13 Plastic Arrived
21-june-18 Plasic Arrived