Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

converting access macro to vba module using 'save as' command

Status
Not open for further replies.

uscitizen

Technical User
Jan 17, 2003
672
US
according to something i remember reading, if you have a macro affixed to an event property, say 'on click' of a button, and using the 'save as' command convert that macro to a vba module, ms access should handle the task of placing the vba module in the position the macro held. what i'm finding with my ms access 2000 data base is not the same: for one thing, the name of the saved module is changed automatically in the process to read "Copy of X" when the name of your macro is "X" and no exchange occurs.

what to do? any suggestions?
 
You need to perform the conversion in a different way.
Code:
  1. Open your form in design view.
  2. Click Tools-->Macros-->Convert Form's Macros to Visual Basic.

That way the macro name will be replaced with [Event Procedure] in the click event and the actual code will be written to the form's module.



VBSlammer
redinvader3walking.gif

Unemployed in Houston, Texas
 
My source as it turns out was page p19 of E. Callahan's "Microsoft Access 2000 VBA Fundamentals" which states "To convert an individual macro, select the macro in the Database window, click Save As/Export on the File menu, and then click Save As Visual Basic Module. To convert all the macros used with a form, open the form in Design view, click Macros on the Tools menu, and then click Convert Form's Macros To VB. Access not only creates procedures for all the macros, it attaches them to the same events so that your application works just as before". This appears to be what you're suggesting. The thing is I don't want to convert all Macros on this form to VB modules -- at least not yet.
 
Hold the presse.......

I think I've solved this problemo: using the "=Call([Module_Name_of_Macro])" syntax in the event works!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top