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

Autonumber field on a form

Status
Not open for further replies.

lexis7

Programmer
Sep 23, 2002
26
US
Hi-

I am trying to create an autonumbered field on a form.

I have created a txtbox named "txtAutoNumber"

I am using this form to add new records to a table.

The table already has 800 records.

How do I create the autonumber field to start at #801?

Any help would be great!

Thanks in advance!
~Alexis
 
If your last autonumber is 800, then I would compact the database that contains the table. That should start you autonumbering back to 801.
 
thanks for the suggestion, but it didn't work. maybe i didn't explain things well enough. let me try again.

-i created a form to allow users to enter a new contact.
-the fields on the form will be added to the table "Main Contacts"
-this table already has 800 entries and a Key field named "ID" (an autonumbered field)
-on the form i created a hidden textbox named "txtAutoNumber"
-when i add a record i want the "txtAutoNumber" to be bound to the ID field, so that the information for 801 will go to the record 801.
-i don't know how to format the textbox so that this happens.
-should i bound it to the ID field?

hope this expains things a bit better.
thanks again for your help!
 
If I understand correctly you may want to do as I often have. I place a textbox bound to Whatever_ID and then hide it. when the
Code:
do.cmd gotorecord,,acnewrec
(or what ever the exact code is) is carried out - the box holding the ID number and the data in the other boxes are bound to the record numbered in the hidden box.

help you? -Matt
 
Yes you would bind it to the autonumber Id in your table then since this form is for new contacts you could set the Form Property Data Entry to yes, which will make it so it goes to new record automatically. As soon as data is entered into any other field for example contact name, the textbox that is bound to the tableid that is autonumbered will generate the autonumber based off the table.

Bill
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top