VBA Code Replication

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

Guest

In VBA attched to command buttons on a form I load data into a template run a
loop process to add a cumlative total to the data then output to Excel. How
do I set up my loop process and a "DoCmd." process so that I do not have to
replicate the 30 lines of code on every button?
 
Chase said:
In VBA attched to command buttons on a form I load data into a template run a
loop process to add a cumlative total to the data then output to Excel. How
do I set up my loop process and a "DoCmd." process so that I do not have to
replicate the 30 lines of code on every button?

Write your code as a Public function in a Standard Module. Then in the
button's property sheet, you can use a line like:

=MyFunction("Arg1", Arg2)
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:
http://www.datastrat.com
http://www.mvps.org/access
 
Back
Top