SQL statement in an external database...

  • Thread starter Thread starter jpang
  • Start date Start date
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
 
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/
 
Back
Top