Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to Delete a Module Programatically 1

Status
Not open for further replies.

lollyjar

Programmer
Aug 3, 2003
29
GB
Does anyone know how to delete a module programatically?

Cheers
 
Hi

How about docmd.deleteobject

You can use the DeleteObject action to delete a specified database object.

Setting

The DeleteObject action has the following arguments.

Action argument Description
Object Type The type of object to delete. Click Table, Query, Form, Report, Macro, Module, Data Access Page, Server View, or Diagram, Stored Procedure in the Object Type box in the Action Arguments section of the Macro window. To delete the object selected in the Database window, leave this argument blank.
Object Name The name of the object to delete. The Object Name box shows all objects in the database of the type selected by the Object Type argument. If you leave the Object Type argument blank, leave this argument blank also.
If you run a macro containing the DeleteObject action in a library database, Microsoft Access looks for the object with this name first in the library database, then in the current database.


Warning If you leave the Object Type and Object Name arguments blank, Microsoft Access deletes the object selected in the Database window without displaying a warning message when it encounters the DeleteObject action. To select an object in the Database window, you can use the SelectObject action with the In Database Window argument set to Yes.

Remarks

You can use the DeleteObject action to delete temporary objects you've created while running the macro. For example, you could use the OpenQuery action to run a make-table query that creates a temporary table. When you're finished using the temporary table, you can use the DeleteObject action to delete it.

This action has the same effect as selecting an object in the Database window and then pressing the DEL key or clicking Delete on the Edit menu.

To run the DeleteObject action in Visual Basic, you can use the DeleteObject method of the DoCmd object.


Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top