Macro conversion

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

Guest

If you please,

After converting a macro to VB in the module, as recommended by the Access db performance analyzer, how do you change the form, in a button property (OnClick), to retrieve (run) the code in the module rather than run the macro?
 
If you please,

After converting a macro to VB in the module, as recommended by the Access db performance analyzer, how do you change the form, in a button property (OnClick), to retrieve (run) the code in the module rather than run the macro?

Open the Form in design view; select the command button's OnClick
property. Remove the macro name from the line and click the ... icon,
and select "Code Builder". Access will give you a Sub and End Sub line
for free; copy and paste your code between these lines.

When you return to form design the Click event should show

[Event Procedure]

and doubleclicking it will again bring up the code editor.

Note that the Macro to VBA translator does a very literal, plodding,
line by line conversion; the resulting code should work and be a
decent starting point, but VBA is *much* more flexible than macros,
and the code can often be markedly improved.
 
Back
Top