Conditions

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

Guest

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.
 
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.
 
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.
 
Back
Top