Can application.runcommand run in Access 2002

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have the following code that is being ignored/skipped when running a on a
machine with Access 2002:

Application.Echo False
DoCmd.OpenTable "DataTemplate"
Application.RunCommand acCmdSelectAllRecords
Application.RunCommand acCmdDelete
Application.RunCommand acCmdClose
Application.Echo True

I'm guessing that Access 2002's libraries don't have these commands available.

Thanks,

Matt
 
DoCmd.RunCommand should work, but an easier way to delete all records (do
you really want to do that?) is to run a delete query...

CurrentDb.Execute "DELETE DataTemplate.* FROM DataTemplate;"
 
RunCommand is a Method of the DoCmd Object and not a Method of the
Application Object. In addition, DoCmd is a Property of the Application
Object. Thus, if you want, you can use:

Application.DoCmd.RunCommand ...

but in Access VBA, the DoCmd is a "global" Property so you don't even need
to use the Application Object and simply use:

DoCmd.RunCommand ...

But for deleting all Records in a Table, Joan's method is the most
efficient.
 

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

Back
Top