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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Autonumber problem

Status
Not open for further replies.

laquer09

MIS
Mar 14, 2003
10
I have a database in Access 2000 which was using autonumber to autofill the key, "Item Number" on a form that allows users to input new "Items." I needed to batch input some items so I did it in excel and imported the entire table. Autonumber has now been turned to number and I can't change it back. I was wondering how I could programatically autofill the "Item Number" on the form to be 1 + the Item Number of the last record. Any suggestions?
 
Hi laquer09,

Several ways, but what you need to do is find the maximum value and add 1, so in some event (perhaps on curent) you need code like ..

Code:
if isnull(me.Item_Number) Then
    me.item_number = dmax("item number","items") + 1
end if

Enjoy,
Tony

------------------------------------------------------------------------------------------------------
We want to help you; help us to do it by reading FAQ222-2244 before you ask a question.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top