Microsoft Access Forums

Go Back   Microsoft Access Forums > Access Forums > Access

Reply
 
LinkBack Thread Tools Display Modes
  #1  
Old 06-30-2009, 08:25 AM
bullwinkle55423 bullwinkle55423 is online now Windows XP Access 2003 (version 11.0)
Novice
 
Join Date: Aug 2006
Posts: 7
bullwinkle55423
Default Resetting autonumber when importing

I have a table set up that I import an Excel file to. This table has an autonumber field to keep the sequence of the rows set. Before I do an import, I delete all of the records form the import table. However, the autonumber field starts with the last number used and it is getting to be a pretty large number.

Is there a way, either in the table properties or via VBA code, to reste the autonumber to 1 or some other number.

Thank you for your help.
Reply With Quote
  #2  
Old 06-30-2009, 08:28 AM
RuralGuy's Avatar
RuralGuy RuralGuy is online now Windows 7 Access 2007 (version 12.0)
Administrator
 
Join Date: Mar 2007
Location: 8300' in the Colorado Rocky Mountains
Posts: 4,263
RuralGuy will become famous soon enoughRuralGuy will become famous soon enough
Default

You should find this link helpful.
__________________
(RG for short) aka Allan Bunch MS Access MVP - WinXP Pro, Win7 - acXP, ac07
If your issue is resolved...follow this link for directions on how to use the Solved thread tool!
Teaching is not filling a bucket but lighting a fire. Borrowed quote..."Docendo discimus"
Reply With Quote
  #3  
Old 06-30-2009, 09:47 AM
bullwinkle55423 bullwinkle55423 is online now Windows XP Access 2003 (version 11.0)
Novice
 
Join Date: Aug 2006
Posts: 7
bullwinkle55423
Default I'm not sure this worked..

I tried the code that you provided, but it didn't seem to reset the autonumber. And as I looked at the code, it appears to only work if I want to set the counter higher. (If the highest number is 500, I can make the next one 1000). But it doesn't let me reset it back to 100 or 1.

Am I missing something?
Reply With Quote
  #4  
Old 06-30-2009, 09:56 AM
RuralGuy's Avatar
RuralGuy RuralGuy is online now Windows 7 Access 2007 (version 12.0)
Administrator
 
Join Date: Mar 2007
Location: 8300' in the Colorado Rocky Mountains
Posts: 4,263
RuralGuy will become famous soon enoughRuralGuy will become famous soon enough
Default

With all of the records deleted, if you Compact and Repair the AutoNumber seed is set back to 1.
__________________
(RG for short) aka Allan Bunch MS Access MVP - WinXP Pro, Win7 - acXP, ac07
If your issue is resolved...follow this link for directions on how to use the Solved thread tool!
Teaching is not filling a bucket but lighting a fire. Borrowed quote..."Docendo discimus"
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problems with autonumber field in a form admaldo Forms 0 02-25-2008 08:09 AM
AUTONUMBER J A F F A Database Design 1 10-03-2007 08:30 AM
Customizing the Autonumber field wasim_sono Access 1 09-01-2006 05:27 AM
duplicate autonumber rayc Access 0 01-16-2006 06:57 AM
do all primary keys use autonumber k Database Design 4 11-22-2005 06:32 AM


All times are GMT -8. The time now is 02:39 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.