Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to use autonum field and not let it increase when DoCmd.Close? 1

Status
Not open for further replies.

cfvcf

Technical User
Nov 8, 2007
77
US
I'm sure this is simple and it works on another app I have, but this app - when I code: DoCmd.OpenForm "frm_Household_Inventory", acAdd, "", "", acFormAdd, acNormal
The ID is an autonum field, and when the form opens the autonum increases to the new number (30) although when I look in the table that last number used was 23. I have a cancel button that has:
'DoCmd.DoMenuItem acFormBar, acEditMenu, acUndo, , acMenuVer70 (commented out because it made no difference)
DoCmd.Close
I have the same code in another form that leaves the autonum field as (AutoNumber) until I click in the first field that has focus. In both forms if I click ESC the fields clear and the autonum field shows (AutoNumber).

This isn't a hugh deal, but while testing I'm getting the numbers totally out of whack. Any ideas?
 
Thank you, I appreciate the info, gives me another approach!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top