make table query

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
 
T

Tim Ferguson

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top