Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 512
  • Last Modified:

Problem with auto number field inserting a record

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
CRB1609
Asked:
CRB1609
  • 4
  • 3
1 Solution
 
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)Commented:
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
 
CRB1609Author Commented:
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
 
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)Commented:
Did you delete a bunch of records at some point ?
0
Get quick recovery of individual SharePoint items

Free tool – Veeam Explorer for Microsoft SharePoint, enables fast, easy restores of SharePoint sites, documents, libraries and lists — all with no agents to manage and no additional licenses to buy.

 
CRB1609Author Commented:
Yes.
0
 
hnasrCommented:
If you delete last records, then Compact and repair database, it restarts from last value of autonumber+1.
0
 
CRB1609Author Commented:
Perfect, thank you.  Why didn't I think of that???
0
 
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)Commented:
Sorry ... I had to leave work. hnasr beat me to the solution.
0
 
CRB1609Author Commented:
Sorry about that.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now