DoCmd.DeleteObject ...Where ...

M

Mark

The following code is from Q160875: to first delete objects in a target
database before exporting from the current database. I need a Where clause
to delete only the objects in the target database which match the names in
the current database. Thank you for any help.
Mark.

Public Function TransferObject(Filename As String, objType As_ Integer,
objName As String)
On Error GoTo TransferObject_Err
Dim accObj As New Access.Application
accObj.OpenCurrentDatabase Filename
accObj.DoCmd.DeleteObject objType, objName
accObj.CloseCurrentDatabase
Set accObj = Nothing
 
B

Bryan Reich [MSFT]

Your best bet will probably be to simply go through each database object in
your current DB that you want to copy over and delete that object in the
target DB one by one. I don't think there's a really clever single query or
anythign you can write to do this in one shot, but writing a loop to do it
one by one shouldn't be too terribly difficult.
 

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

Top