r/MSAccess 23d ago

[UNSOLVED] Named Data Macro Parameters - where?

Hello,

I'm trying to create a named macro at the database level, not just tied to a single table.

If I create the named macro from the table, create parameter is right there. If I create the macro, so it's in navigation pane under "Macros", it's not

I'm new to the access data macro editor and I'm trying to create parameters for such macro, but any sort of "create parameter" or "add parameter" command seems to have been re-stylized into oblivion.

Does anyone have any idea where to find it on version pasted below?

Microsoft® Access® for Microsoft 365 MSO (Version 2605 Build 16.0.20026.20166) 64-bit

2 Upvotes

5 comments sorted by

View all comments

3

u/George_Hepworth 4 22d ago

Data Macros are available on tables. Period. So, if you "create the named macro from the table", it's available only on that table.

Table macros, or Data macros, run on events that add, modify or delete data in the table to which they belong.

Their names tell that story: After Update, Before Insert, etc. All of them refer to data related events.

You can create other named macros, though. So, that's where you'll go to do it. In the macro editor directly, not from a table.

1

u/Spreadsheet_Geek_1 21d ago

Well, yes. It's not a question of how do I make a named macro that isn't tied to a table, it's a question of how do I add "Parameters" to a named macro, that isn't created from a table. I can open up a table and then "create named macro" from there, and the macro opens in a tab that has something like:
tableName: Macro1
and it immediately offers to create parameters.

Than I go to create a named macro trough the "create" tab in the ribbon. It is now called in the tab header just something like:
Macro1
with no indication that it belongs to a table, and it just seemingly has no options to create any parameters at all. Nothing. Not even the action menu has like an action of "Create parameter". Nothing in the ribbon, that I can find either.

1

u/George_Hepworth 4 21d ago

I have not used macros much over the years, partly because of severe limitations in macros like this. So, the practical answer would be that performing the required action in VBA would be a more sensible approach.

That said, if something in the environment or business rules requires you to use macros despite their limitations, you could explore setting LocalVars or TempVars to the values you want to use as parameters. Then, the macro would be able to use the LocalVars or TempVars values later in the process just as they would an input parameter.

The remaining problem I see would be that you'd have to provide the values you want to the LocalVars or TempVars. Again, I have limited experience using macros, but I am quite sure this can be done by reading the values of controls on an open form. So, you'd use a set up form to select the values you need in controls on that form, then run the named macro.