Controlling Autonumber Fields : Autonumber « Access « VBA / Excel / Access / Word






Controlling Autonumber Fields

 
Sub CreateAutonumber()
    Dim cmd As ADODB.Command
    Set cmd = New ADODB.Command

    cmd.ActiveConnection = CurrentProject.Connection
    cmd.CommandText = "CREATE TABLE Customers2 " & _
        "(CustomerID AUTOINCREMENT (100000,1), " & _
        "CompanyName TEXT (50), IntroDate DATETIME, " & _
        "CreditLimit CURRENCY DEFAULT 5000)"
    cmd.Execute
End Sub

 








Related examples in the same category

1.Retrieve the last-assigned autonumber value