autonumber

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am trying to set up a form that I can enter new data into and automatically
update into my table. I want to have my OrderID update automatically
everytime I open the form so that it corresponds to my table. How do I set
autonumber as the control field so that the next available number shows up on
the form? Also, when I have completed filling out the form, how do I get it
to automatically update on my table? Thanks
 
Harvey ,
A. How do I set autonumber as the control field so that the next available
number shows up on the form?

On autonumber only shows : Autonumber , unless you put data on other field
when you open a form then the autonumber will show the next record .
just be sure that property autonumber on the table should be set to
increment .
(There are two value you can choose : Autonumber or random )

If you want to have show it automatically then you could create on current
function .

private sub Form_current()
' txtOtherdata is another control on the form to trick access autonumber
shows the next record .
' Make sure that the non empty value won't be replaced by empty string .
if isnull(me!txtOtherData) then
me.txtotherdata = vbnullstring
end if
end sub

B. how do I get it to automatically update on my table?
It is updated automatically if you are using bound form ( record source
property set to a table)
 
The Autonumber datatype should NOT be used to create a sequential number.
This is because gaps can develop that cannot be recovered. If you search
these forums on "Autonumber" you will find many, many posts detailing why.

Your best bet is to create your own sequential numbering system.

On my website (www.rogersaccesslibrary.com), there is a small sample
database called "AutonumberProblem.mdb" which shows one method.

--
--Roger Carlson
Access Database Samples: www.rogersaccesslibrary.com
Want answers to your Access questions in your Email?
Free subscription:
http://peach.ease.lsoft.com/scripts/wa.exe?SUBED1=ACCESS-L
 
Back
Top