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 Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Running this code in Macro

Status
Not open for further replies.

ebizleads

Technical User
Sep 14, 2005
57
US
I need to run this code in a macro:

Private Sub savereport_Click()
DoCmd.OutputTo acOutputReport, "test", acFormatRTF, "C:\MyDebtIQ\" & Me.ClientID & ".rtf"
End Sub

How do I set this up?

Thanks!

EbizLeds
 
Hmmm...I need to run a series of events before this code and a few after. All of which I have set up in a macro.

 
Convert your macro to VBA code ...

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
So you have a macro already and you run some events in this macro and then you want to run the code above and then do some things from the same macro? Just making sure I understand what you need.
 
I would do what PHV said. It will be much easier to do that and will make it much eaiser to edit. Or a another way that will work is to make that code into a function and in your macro chose RunCode and then point it to that function. Then in the click event you posted above just call the function or leave the code there.

PHV's idea is probably the best though.....
 
If I can't make the code part of the macro, converting it to vba doesn't do it.

I've tried making this a function...a little weak in this area. I know how to set this up in macro if I had the function...any way to get a little help making this a function?
 
Right click the macro name in the database window and play with the SaveAs option.
 
Once you make the macro VBA then you can put the code where you want it. Access will conver the macro to VBA for you and put it a module.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top