How to create a table in access 2007 with AutoNumber Datatype

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sentimental37
    New Member
    • May 2010
    • 23

    #1

    How to create a table in access 2007 with AutoNumber Datatype

    I want to create a table in access 2007 by query not in design view. My table should look like;
    Serial AutoNumber
    Name Text
    Country Text
    I am using the following query:
    CREATE TABLE Details (Serial AutoNumber, Name TEXT, Country Text)


    But its returning an error (Sysntax error in field definition ) with AutoNumber Highlighted .Plzz help
  • evildracko
    New Member
    • Jul 2010
    • 14

    #2
    ... what i can tell is that to reste autonumber ina access is "CurrentDB.Exec ute "ALTER TABLE tablename ALTER COLUMN ColumName COUNTER(1,1)"

    so try changing the data type to Counter...

    hope thhis help

    Comment

    • NeoPa
      Recognized Expert Moderator MVP
      • Oct 2006
      • 32669

      #3
      As Dracko says, the thing to use is Counter(1,1), rather than AutoNumber. In fact you can create the table directly this way with :
      Code:
      CREATE TABLE Details (Serial Counter(1,1),
                            Name TEXT,
                            Country Text);
      A Best Answer for Dracko on this one may be appropriate :)

      Comment

      Working...