Share via

How to Delete table data macros via vba code?

Anonymous
2024-01-12T15:25:40+00:00

I am looking for sample vba code showing/describing how to delete table data macros via code. I have tried DoCmd.DeleteObject acTableDataMacro, .... but get the message

Error 2487 (The Object Type argument for the action or method is blank or invalid.)

Thanks in advance.

jdraw

Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Tom van Stiphout 40,211 Reputation points MVP Volunteer Moderator
2024-01-12T20:27:13+00:00

The file is zero bytes.

Was this answer helpful?

1 person found this answer helpful.
0 comments No comments

8 additional answers

Sort by: Most helpful
  1. Anonymous
    2024-01-12T18:34:22+00:00

    Imb_HB,

    You have provided the manual steps required to Rename/Delete a Data Macro.

    I am aware of the manual approach. My question/goal is to find an automated means of Deleting an existing TableDataMacro(s).

    Tom provided a line of code, but I am unable to get it to work without knowing details of what he used as XML_BLANK_FILE.

    Thanks for responding.

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2024-01-12T18:17:30+00:00

    I am looking for sample vba code showing/describing how to delete table data macros via code. I have tried DoCmd.DeleteObject acTableDataMacro, .... but get the message

    Error 2487 (The Object Type argument for the action or method is blank or invalid.)

    Hi jdraw,

    I found this:

    Use this procedure to delete any named or event-driven data macro:

    1. In the Navigation Pane, double-click any table to open it in Datasheet view.
    2. On the Table tab, in the Named Macros group, click Named Macro, and then click Rename/Delete Macro.
    3. In the Data Macro Manager dialog box, click Delete next to the data macro that you want to rename.

    Note: You can also delete an event-driven macro by deleting all of its actions.

    Until now (A2007) never heard of Data Macro's.

    Are they just handy to start, and - like MVF's - give more problems than they solve?

    I want to keep the tables as "clean" as possible, so just tables, and dynamical forms to manipiulate the data.

    Imb.

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2024-01-12T18:07:27+00:00

    Tom,

    Thanks for responding. I have downloaded latest NW developer template and can not find any reference to XML_FILE_BLANK. I also have had no luck with searching for deleting Table Data Macro within NorthWind or other.

    I have tried creating a minimal xml file named XML_BLANK.xml.

    <?xml version="1.0" encoding="UTF-8"?>
    <root>
    <!-- This is a blank XML file -->
    </root>

    but when using it with

    LoadFromText acTableDataMacro,"tblSource", "C:\users\jp\documents\XML_BLANK.xml"

    The following error results.

    Error 3870 (Microsoft Access cannot interpret the text you are pasting as a data macro. Correct the text and then try again.)

    Do you have a sample XML_FILE_BLANK you can share?

    Was this answer helpful?

    0 comments No comments
  4. Tom van Stiphout 40,211 Reputation points MVP Volunteer Moderator
    2024-01-12T16:11:07+00:00

    We were doing that in the NW2 project: import an empty data macro.

    Example:
    LoadFromText acTableDataMacro, "Customers", XML_FILE_BLANK

    Was this answer helpful?

    0 comments No comments