how do i use an sql script to create an access database

G

Guest

i have created an sql script that creates a series of tables and inserts
some test data into the table but i now want to convert the script into
access do i have to create the tables manually in access or can i do it
automatically?
 
G

Guest

Perhaps I am being over-simplistic, but have you tried just creating a new
blank query in Access, going to SQL view, pasting in your SQL statement, and
saving the query?

Then you could just run DoCmd.OpenQuery "<QueryName>" in VB.

Alternatively, you could manually create the Make-Table query, save it, and
run it as needed via VB the same way.
 
J

John Nurick

Hi Philip,

Access can't run SQL scripts but can execute single DDL and DML
statements. Either paste the statement into the SQL view of a query, or
use the database's Execute method.

In principle you can automate this by writing VBA code to read and
execute the script a statement at a time. In practice, it depends on
whether the SQL you used is compatible with Jet SQL (look in the Access
Help table of contents for "Microsoft Jet SQL Reference).
 

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