dcsimg
Results 1 to 2 of 2
  1. #1

    Thread Starter
    Member kutlesh's Avatar
    Join Date
    Jun 2018
    Location
    Skopje, R. Macedonia
    Posts
    48

    How to create table with VBA code that has its ID as AutoNumber?

    I tried this function that creates sql string:

    Code:
    Public Function createTableProbaAutoNumber(ByVal tableName As String) As String
        Dim sql As String
    
        sql = "CREATE TABLE " & tableName & " (ID Long Integer PRIMARY KEY AUTONUMBER, Field1 TEXT)"
    
        createTableProbaAutoNumber = sql
    End Function
    But it doesn't work.

    How can I set a field as AutoNumber with VBA code?
    What is the right syntax?

  2. #2
    Frenzied Member gibra's Avatar
    Join Date
    Oct 2009
    Location
    ITALY
    Posts
    1,543

    Re: How to create table with VBA code that has its ID as AutoNumber?

    CREATE TABLE Statement (Microsoft Access SQL)
    https://msdn.microsoft.com/en-us/lib.../ff837200.aspx

Tags for this Thread

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width