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

  • Thread starter Thread starter Guest
  • Start date Start date
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?
 
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.
 
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).
 
Back
Top