Results 1 to 2 of 2

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

  1. #1

    Thread Starter
    Addicted Member kutlesh's Avatar
    Join Date
    Jun 2018
    Location
    Skopje, Macedonia
    Posts
    202

    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
    gibra
    Guest

    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
  •  



Click Here to Expand Forum to Full Width