How to add autonumber field to ACCESS using ALTER Command

Results 1 to 5 of 5

Thread: How to add autonumber field to ACCESS using ALTER Command

  1. #1
    Dan Dean Guest

    Default How to add autonumber field to ACCESS using ALTER Command

    Does anybody know how to alter an ACCESS TABLE, using a SQL EXECUTE<BR>command, so that I can add a new field, with type AUTONUMBER?<BR><BR>I can add a new column using:<BR>ALTER TABLE NewMemberCC ADD COLUMN nmautoid Long;<BR><BR>But, I want it to have the autonumber feature that each record will have<BR>a unique sequential number. IE. Newvalues propery = increment.<BR><BR>If I substitue the above "Long" with "auto" or "autonumber", I just get<BR>errors...<BR><BR>Thanks in advance,<BR>Dan Dean

  2. #2
    Join Date
    Dec 1969
    Posts
    1,315

    Default RE: How to add autonumber field to ACCESS using ALTER Command

    We can create tables, fields etc either by using SQL or VB (DAO).<BR>Unfortunately, there are many of the properties available for tables and columns cannot be done by using SQL alone, including<BR>creating AutoIncrement field (We must use DAO to create this<BR>field).<BR><BR>hope that helps.<BR><BR>John Weeflaar

  3. #3
    Join Date
    Dec 1969
    Posts
    1,315

    Default Correction, use COUNTER for auto number field in ACCESS

    I&#039m Sorry, yes I found out finally, that I can create an auto number field using SQL for Access database.<BR>use: COUNTER as the SQL data type.<BR><BR>However, using DAO gives me more ways to setup all properties for<BR>tables, and fields.<BR><BR>Thanks,<BR>John Weeflaar

  4. #4
    Dan Dean Guest

    Default RE: Correction, use COUNTER for auto number field in ACCESS

    Thanks John! This is not documented in the ACCESS help index. I have set up an online SQL entry screen that allows me to update my net database on the fly. I just couldn&#039t add an autonumber field until now!<BR>Dan Dean


  5. #5
    Join Date
    Dec 1969
    Posts
    1,315

    Default RE: Correction, use COUNTER for auto number field in ACCESS

    Thanks Dan.<BR><BR>Cheers,<BR><BR>John Weeflaar

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •