make table query

  • Thread starter Thread starter Craig
  • Start date Start date
C

Craig

I need to know the syntax for doing a maketable query in
VBA. or at least for embedding SQL code for that into
VBA.

lets say, for example, i want to make a table with 2
columns called VendorName, VendorID.

help would be appreciated. Thank you very much...

Craig
 
I need to know the syntax for doing a maketable query in
VBA. or at least for embedding SQL code for that into
VBA.

strSQL = _
"SELECT VendorID, VendorName " & _
"FROM OldVendors " & _
"INTO NewVendors " & _
"WHERE ToBeCopied = TRUE "

db.Execute strSQL, dbFailOnError

lets say, for example, i want to make a table with 2
columns called VendorName, VendorID.

I have this feeling that you mean a DDL query rather than a maketable one:
in which case it would be something like

strSQL = _
"CREATE TABLE Vendors (" & _
"VendorID IDENTITY(1,1) NOT NULL " & _
" CONSTRAINT pk PRIMARY KEY, " & _
"VendorName VCHAR(72) NULL " & _
")"

db.Execute strSQL, dbFailOnError

Hope that helps


Tim F
 
Back
Top