how do i automatically run a make-table query? i tried doing the docmd.open
query command and it's giving me an error.
here it is: DoCmd.OpenQuery qryCat3, acViewNormal, acReadOnly
Note that MakeTable queries are VERY rarely actually necessary. You
can use a Select query as the recordsource for a Form or Report; you
can export from a Select query; you can base another query on a Select
query.
Why do you feel that a MakeTable query is necessary? And what
provision have you made to delete the table named in the MakeTable?
All that said... try
Dim db As DAO.Database
Dim qd As DAO.Querydef
Set db = CurrentDb
On Error GoTo Proc_Error
Set qd = db.Querydefs("qryCat3")
qd.Execute dbFailOnError
....
Proc_Exit:
Exit Sub
Proc_Error:
<handle the error condition appropriately>
Resume Proc_Exit
End Sub
The Execute method runs action queries, and lets you trap errors (such
as duplicate table names... <g>)
John W. Vinson[MVP]