Autonumber

  • Thread starter Thread starter Günter Brandstätter
  • Start date Start date
G

Günter Brandstätter

Hi all,
I tried to create an autonumber-field in a table programmatically, but I
can't find the Type 'vbAutonumber' or something similar.
Can anyone tell me how to manage this?
Using DAO3.6

Thanks in advance
Günter
 
Hi,

Here's an example:

Create Table tblMyTableName (FirstName TEXT, LastName TEXT, EmployeeID
AutoIncrement)
 
Hi Calvin,
Thank you for your prompt answer.
Maybe my question was not clear enough. I have an existing table where I
want to add an autonumber-field programmatically.

Thanks
Günter
 
Hi,

You're welcome! :-)
I have an existing table where I
want to add an autonumber-field
programmatically.

Okay, here's another example:

Alter Table tblAddAutoNumberToMe Add MyAutoNumber AutoIncrement
 
Hi Calvin,

thank you for your help,
it took me some time to find out how to understand your code, but I found
that it was SQL.
I used
strSQL="Alter Table tblAddAutoNumberToMe Add MyAutoNumber AutoIncrement"
dbs.Execute(strSQL)

thanks again
Günter
 
Hi Günter,

Sorry for the confusion. I assumed that you wanted SQL, which is a more
elegant approach in this case [IMO] than the CreateField method. Glad it all
worked out for you. :-)
 
Back
Top