OUCH!
Dude, that's not the way to do this. Again, what do you want to do?
Don't try to manipulate the table using Access menus. Write the sql.
If you want to make the table then make the table. If you want to
delete all records and append new ones, then do that.
Dim dbs As DAO.Database
Dim sSQL As String
Set dbs = CurrentDB()
' 1) Delete and append records
sSQL = "DELETE FROM tblZZZ"
dbs.Execute sSQL
sSQL = "INSERT INTO tblZZZ SELECT * FROM qryZZZ"
dbs.Execute sSQL
' 2) Drop and recreate table
sSQL = "DROP TABLE tblZZZ"
dbs.Execute sSQL
sSQL = "SELECT * INTO tblZZZ FROM qryZZZ"
dbs.Execute sSQL
No menus, no RunCommand ... just pure SQL. It works, it's clean
it's readable, it's efficient. But first, you need to be clear about
what you wish to accomplish. I'm still not clear on that.
--
Danny J. Lesandrini
dl*********@hotmail.com http://amazecreations.com/datafast
"Ed Robichaud" <ed*********@wdn.com> wrote ...
The code below deletes records from an existing table, then runs an append query to add records to that table; all
without user input or interference.
-Ed
DoCmd.SetWarnings False
DoCmd.OpenTable "tblZZZ"
DoCmd.RunCommand acCmdSelectAllRecords
DoCmd.RunCommand acCmdDeleteRecord
DoCmd.OpenQuery "qryMakeZZZ", acViewNormal, acEdit
DoCmd.close acTable, "tblZZZ"
DoCmd.SetWarnings True
"ken" <ge****@gmail.com> wrote in message news:11**********************@z14g2000cwz.googlegr oups.com... Hi,
I use this command to run a make table query without opening it...
CurrentDb.Execute "make table query name"
Access tells me that it can't execute a select query...? Its a make
table query not a select? Or are those two the same.
Bottom line is that the DoCmd.OpenQuery alowes the user to see the
query and I don't want that...
Anything else I could use other then Currentdb.execute?