SQL statement in an external database...

J

jpang

Hello,

I would like to know how I can create and execute a Make Table SQL statement
in an external database from my current database via VBA codes.

Any help will be greatly appreciated. Thanks!

jpang
 
T

Tony Toews [MVP]

jpang said:
I would like to know how I can create and execute a Make Table SQL statement
in an external database from my current database via VBA codes.

You want to use the SQL IN clause. However the examples aren't that
clear.

Here is a sample INSERT statement I have for inserting records from
one table into another in another MDB. You should be able to figure
out the Make Table part yourself.

strSQL = "INSERT INTO ServiceRecordInvoices " & _
"( sriID, sriServiceRecordID, sriInvoiceDate,
sriInvoiceNumber, sriDescription, sriInvoiceAmount ) " & _
" IN '" & strDatabasePathandName & "' " & _
"SELECT srpID, srpServiceRecordID, srpInvoiceDate,
srpInvoiceNumber, srpParts, srpPartsAmount " & _
"FROM ServiceRecordParts IN '" & strDatabasePathandName & "';"

Note the two lines above which word wrap.

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
 

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