Macros out VBA in

Dwight

Registered User.
Local time
Today, 11:54
Joined
Mar 17, 2003
Messages
168
Hello,

I am beginning to learn VBA and would like to use code to replace the macros in my database. My question is very simple.

I have a report “rptCashBalances” that uses a parameter query based on dates to generate the records. I have a form “frmDateDialog” to input the selected date.

Currently, the macro does these steps:

1) User double clicks report icon - Macro opens Date Dialog form
2) User enters the date and clicks “OK” button and – Macro opens Cash Balance report

I would like this to be done by VBA. Once I get one solid example I will be able to use it in many places in my database. I tried to adapt some code I pieced together but it printed the report which was good for a laugh and not much else.

Any help is appreciated.

Kind regards, Dwight
 
Dwight,

You can take your macro that does this and save it as VBA.
Then you can look at the code. I don't know the exact verbage
for doing this because I don't have Access on this machine,
but its there as an option.

Your code will just be doing:

DoCmd.OpenForm "SomeForm"
DoCmd.OpenReport "SomeReport",,,,"SomeDate = #" & Me.SomeDate $ "#"

Not exactly sure on the number of commas, but you should find
some examples here with a search.

Wayne
 
Right-Click on the Macro name, select Save As, in the combobox select Module.
 
Thanks for the help.

I found an article called: Macros: Tips and Tricks by Robert Flake on the Microsoft that deals with this specific issue in depth if any other beginners are looking for help on the subject.

- Dwight
 

Users who are viewing this thread

Back
Top Bottom