-----Original Message-----
is there any way to execute a "batch" of sql statements in an access database?
.
Try this Steve:
1) Create a table SQLBATCH to include a field
SQL_STATEMENT (Memo type to have enough space for your SQL
statements.)
2) Put your sql statements in the table.
3) copy this function to a module in the same database.
Function runSQL()
Dim rst As Recordset
Set rst = CurrentDb.OpenRecordset("select SQL_STATEMENT
from " & _
"SQLBATCH where
SQL_STATEMENT Is Not Null")
'if SQLBATCH is empty
If rst.RecordCount < 0 Then
Exit Function
End If
While Not rst.EOF 'execute all SQL statements
CurrentDb.Execute rst(0)
rst.MoveNext
Wend
rst.Close
End Function
3) execute runSQL()
NOTE: your sql statements have to be valid of course. I
also assumed that
you have quite a few sql statements.