Link to home
Start Free TrialLog in
Avatar of Clive Beaton
Clive BeatonFlag for Australia

asked on

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.
Avatar of DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
Flag of United States of America image

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
Avatar of Clive Beaton

ASKER

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.
Did you delete a bunch of records at some point ?
Yes.
ASKER CERTIFIED SOLUTION
Avatar of Hamed Nasr
Hamed Nasr
Flag of Oman image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Perfect, thank you.  Why didn't I think of that???
Sorry ... I had to leave work. hnasr beat me to the solution.
Sorry about that.