Do you receive the Programmer's Heaven newsletter? If not, why not subscribe?

VBA

Moderators: PavlinII
Number of threads: 1398
Number of posts: 2677

This Forum Only
Post New Thread

Report
Datatype Problem Posted by Sagacious on 21 Jun 2002 at 10:36 AM
In a continued effort of creating tables I've encountered another small problem. I can't seem to track down the Autonumber datatype to use in the creation of an Access table from ADO.

This just isn't working:
strSQL = "CREATE TABLE ExhibitorListNew ([ExhibitorID] short," _
        & " [Exhibitor] text(50), [Order] Autonumber)"


Everything works but Autonumber. All help is ALWAYS appreciated.

Thanks in advance,
Sagacious
Report
Re: Datatype Problem, create table, autoincrement, counter, query Posted by kuroneko on 18 Dec 2008 at 1:29 AM
Hello,

This is not so much a reply, years on, but I spent enough time looking for the answer too that I thought it would be worth posting. Using Office 2003 on XP. The tutorial at http://www.functionx.com/vbaccess/Lesson13.htm shows that COUNTER can be used in place of Autoincrement, so I used in in place of INTEGER for the EmployeeID field in
***************
' Drop the Employees table if it already exists.
On Error Resume Next
conn.Execute "DROP TABLE Employees"
On Error GoTo 0

' Create the Employees table.
conn.Execute _
"CREATE TABLE Employees(" & _
"EmployeeId INTEGER NOT NULL," & _
"LastName VARCHAR(40) NOT NULL," & _
"FirstName VARCHAR(40) NOT NULL)"

' Populate the table.
conn.Execute "INSERT INTO Employees VALUES (1, " & _
"'Anderson', 'Amy')"
conn.Execute "INSERT INTO Employees VALUES (1, 'Baker', " & _
" 'Betty')"
conn.Execute "INSERT INTO Employees VALUES (1, 'Cover', " & _
" 'Chauncey')"
' Add more records ...
********************
from http://www.vb-helper.com/howto_ado_create_table.html. However, had to increment the first three entries manually or they would show up as 1's in the first column of the new table. Similar hint available at http://www.eggheadcafe.com/forumarchives/Accessdevtoolkits/Sep2005/post23732157.asp.

For those still looking.

Kuroneko



 
Popular resources and forums for programmers on Programmersheaven.com
Assembly, Basic, C, C#, C++, Delphi, Java, JavaScript, Pascal, Perl, PHP, Python, Ruby, Visual Basic
© Copyright 2009 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Publisher: Lars Hagelin. Read the latest words from the publisher here.
Be the first to sign up for Lars Hagelin’s In-depth Outsourcing Newsletter here.
bootstrapLabs Logo A bootstrapLabs project.