|
-
May 2nd, 2002, 09:17 AM
#1
Thread Starter
Frenzied Member
can you do this?
Hi,
Can you create an autonumber field when you are creating a table like this? If so, how????
VB Code:
mySQLstring = "CREATE TABLE " & resTableName & " (ResNumber LONG, CustomerID LONG, ReservationDate DATETIME, FreeDay LONG, Status TEXT (50) );"
mydb.Execute mySQLstring
-
May 2nd, 2002, 09:20 AM
#2
Fanatic Member
Create table Table_name (Field1_Name integer IDENTITY(1,1))
This owrks on SQL server, and access 2000...
Leather Face is comin...
MCSD
-
May 2nd, 2002, 09:28 AM
#3
is that via ADO??? I just tried it via DAO and got an error when trying to use the syntax
(Field1_Name integer IDENTITY(1,1))
in access 2000
just asking because by his variable names it looks like he is using DAO
-
May 2nd, 2002, 09:35 AM
#4
-= B u g S l a y e r =-
use COUNTER
VB Code:
Option Explicit
Private db As Database
Private Sub Command1_Click()
Dim sql As String
'create the database
Set db = CreateDatabase("C:\NewDB.MDB", dbLangGeneral, dbVersion40)
'add a table with some fields
sql = "CREATE TABLE TestTable (ID COUNTER, SetName TEXT(50), SetVal TEXT(255), Description TEXT(255))"
db.Execute sql
End Sub
sql will create a field called ID which will be an autonumber field.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|