Conditions

R

Ritesh

I have a DeleteObject argument in my Macro but i only want it to run if the object is actually available to delete, otherwise i want to skip the delete object argument and move on to the next agument

Thanks in advance for any help.
 
K

Ken Snell

I don't know how a macro can easily capture this in a condition. You can do
it more easily if you use VBA code. Or you can use a VBA function that is
called by the macro's Condition expression and that tests whether the object
exists.

But, tell us a bit more about why you need to use this code. Why wouldn't
you already know if an object exists before wanting to delete it? Tell us a
bit more about your setup and when / why you want to run this DeleteObject
step.

--
Ken Snell
<MS ACCESS MVP>
Ritesh said:
I have a DeleteObject argument in my Macro but i only want it to run if
the object is actually available to delete, otherwise i want to skip the
delete object argument and move on to the next agument.
 
J

Jim/Chris

I do not know how to do in a macro but here is the vb code.

Private Sub Update_Data_Click()
On Error Resume Next
Dim stDocName As String
Dim stLinkCriteria As String

DoCmd.DeleteObject acTable, "table name"

Update_Data_Exit:
Exit sub

Update_Data_Err:
MsgBox Error$
Resume Update_Data_Exit

End sub

Jim
-----Original Message-----
I have a DeleteObject argument in my Macro but i only want
it to run if the object is actually available to delete,
otherwise i want to skip the delete object argument and
move on to the next agument.
 

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