Access Autonumber fields in CREATE TABLE 
Author Message
 Access Autonumber fields in CREATE TABLE

I posted a question about this a few weeks back, and stumbling over an
solution yesterday.

The question was how to create an Autonumber field in an Access SQL
statement. All the documentation I'd read to that point (and after)
indicated that it wasn't possible. You first had to define the field as
a LONG in the CREATE TABLE statement, and then use DAO to set a property
for the appropriate Field object.

However, while I was browsing VC's DAO documentation yesterday, I came
across an example of a CREATE TABLE statement that defines fields of
every Access SQL datatype. Turns out there is a barely documented
"COUNTER" data type, which can be used to create an Autonumber field:

                     value AS TEXT(50));

If you run that against Access, you'll create a table with an Autonumber
field named 'key'.

(If you're wondering why I've been so persistent about this, and not
just done the DAO properties hack, it's because we use an SQL-based
scripting language to do bulk database manipulations (kind of like T-SQL
in SQL Server, except it runs against Access as well), and the inability
to create tables with Autonumber fields in straight SQL was turning into
a major problem.)

Mon, 19 Feb 2001 03:00:00 GMT  
 [ 1 post ] 

 Relevant Pages 

1. Create Table (MS Access) with autonumber field

2. How to create a table with Autonumber field?

3. Creating autonumber field to table

4. Create Table with Autonumber Field

5. How do you create table with Autonumber field?

6. Autonumber field in CREATE TABLE?

7. Use VB5 to Create a table with autonumber field

8. How using ADO Create a Table and Specify that a Field is autoNumber and Primary Key

9. create table with autonumber field

10. CREATE TABLE with AutoNumber field

11. Creating an Access datbase on the fly with an AutoNumber field

12. Please Help: Create AutoNumber field in Access DB


Powered by phpBB® Forum Software