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!

Need help with getting an autonumber to work

Status
Not open for further replies.

maryrp2

Programmer
Aug 30, 2002
2
US

I could use some help with the code to get an autonumber "empID" to work. Not sure what to write in code. I am not using any control when connecting to the database. Any Ideas???????

Maryrp2
 
I'm assuming you have a database with a field called empID that is set to autonumber mode. If that's the case, when you add a record to the database, don't fill in a value for the field and the database will automatically assign it.

Are you also asking how to write the record to the database? If so, you'll need to use DAO or ADO to access the database.
 
Thanks for the reply. I did get the autonumber working.

An ADO or DAO are not the only way to connect to a database.

I connect to a database through code only. No controls are in my project.

Mary
 
Out of interest how are you connecting to the database?

DAO and ADO are both metods of connecting to a database, both of which come with a data control(bah, horrible thing!) but you can do it without the controls and still use ADO/DAO. For instance creating an ADO connection object in code

Set cn = ADODB.Connection


This is still using ADO, just not the data control.

:)

Of course it depends on the type of database as well....

Matt

If you can keep your head while those around you are losing theirs, you obviously haven't grasped the seriousness of the situation
 
Hi maryrp2

Sorry for being a pain but how exactly did u get the autonumber working??? Im finding it difficult. I am using oracle for backend. Would be a great help

Thank you in advance
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top