Results 1 to 4 of 4
  1. #1
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 10 Access 2013 32bit
    Join Date
    Feb 2011
    Posts
    2,095

    Syntax error in field definition

    Code:
    CurrentDb.Execute "CREATE TABLE tblLog2 (ID AutoNumber, LogEvent text) "
    What's it supposed to be for an AutoNumber field. Access documentation says it's "AutoNumber", but so far no cigar.

  2. #2
    madpiet is offline Expert
    Windows 10 Office 365
    Join Date
    Feb 2023
    Posts
    565
    Since Allen Browne is way smarter than I am, I'll just post a link to his article... http://allenbrowne.com/func-DAO.html#CreateTableDAO
    if you look near the top of the article, there's a example of creating an identity column with autonumber turned on. It's the very first example.

    (He does it using DAO, not SQL).

  3. #3
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 10 Access 2013 32bit
    Join Date
    Feb 2011
    Posts
    2,095
    There are actually two errors, AutoNumber is one and Text is the other. Statement should read:
    Code:
    CurrentDb.Execute "CREATE TABLE tblLog2 (ID Counter, LogEvent Char)"

  4. #4
    madpiet is offline Expert
    Windows 10 Office 365
    Join Date
    Feb 2023
    Posts
    565
    There's no such data type as Counter. CHAR every time I have ever seen it is a single character.
    Read the article. Really.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 5
    Last Post: 04-25-2014, 11:10 AM
  2. Changing Field definition within a query
    By gm_lowery in forum Queries
    Replies: 5
    Last Post: 08-30-2012, 09:19 AM
  3. Need help in finding Macro definition
    By sdondeti in forum Access
    Replies: 11
    Last Post: 10-31-2009, 04:52 PM
  4. Replies: 0
    Last Post: 08-13-2008, 03:15 PM
  5. Criteria Definition
    By claing in forum Access
    Replies: 1
    Last Post: 12-19-2005, 07:46 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums