AutoNumber data type

G

Guest

The following code works with all data types except AutoNumber. I get a
"Syntax error in field definition" error message. Can anyone help me make
AutoNumber work?

DoCmd.RunSQL "CREATE TABLE tblTest(XYZ Datetime);"
 
G

Guest

I get the same error message with:

DoCmd.RunSQL "CREATE TABLE tblTest(XYZ Identity);"
--
Thank you,
Del


Douglas J. Steele said:
I believe you use Identity rather than Autonumber.
 
D

Douglas J. Steele

Sorry, that's what I get for not looking it up.

DoCmd.RunSQL "CREATE TABLE tblTest(XYZ Counter)"


--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Del said:
I get the same error message with:

DoCmd.RunSQL "CREATE TABLE tblTest(XYZ Identity);"
 
G

Guest

Thanks, that works.
--
Thank you,
Del


Douglas J. Steele said:
Sorry, that's what I get for not looking it up.

DoCmd.RunSQL "CREATE TABLE tblTest(XYZ Counter)"
 
R

RoyVidar

Douglas J. Steele said:
Sorry, that's what I get for not looking it up.

DoCmd.RunSQL "CREATE TABLE tblTest(XYZ Counter)"


The identity syntax works, but on an ADO connection, for instance

CurrentProject.Connection.Execute _
"CREATE TABLE tblTest(XYZ Int Identity);"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top