Solved

Problem with auto number field inserting a record

Posted on 2014-01-17
8
488 Views
Last Modified: 2014-01-17
I have a table with an auto number as the primary key.  The first ID in the table is 5069.

I have a vba function to add a new record to the table, using addnew and update.  The function does not include a value for the ID field.  

When I run the function, the ID of the appended record is 50.  

How do I make the ID the next sequential number in the table?

Thanks in advance.
0
Comment
Question by:CRB1609
  • 4
  • 3
8 Comments
 
LVL 75
ID: 39790110
Is the AutoNumber the 'ID' you are referring to ?
And if so, as you saying it goes from  5069 to  50 ?
If So. what is before 5069 ? Are they sequential ?

mx
0
 

Author Comment

by:CRB1609
ID: 39790116
The auto number is the ID I'm referring to.
If I look at the table in ID sequence, the first record ID is 50, second record ID 5069, and the rest of the records follow on sequentially from 5069.
0
 
LVL 75
ID: 39790119
Did you delete a bunch of records at some point ?
0
Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

 

Author Comment

by:CRB1609
ID: 39790121
Yes.
0
 
LVL 30

Accepted Solution

by:
hnasr earned 500 total points
ID: 39790165
If you delete last records, then Compact and repair database, it restarts from last value of autonumber+1.
0
 

Author Closing Comment

by:CRB1609
ID: 39790176
Perfect, thank you.  Why didn't I think of that???
0
 
LVL 75
ID: 39790236
Sorry ... I had to leave work. hnasr beat me to the solution.
0
 

Author Comment

by:CRB1609
ID: 39790274
Sorry about that.
0

Featured Post

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

832 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question