Help with modules

  • Thread starter Thread starter Tony Williams
  • Start date Start date
T

Tony Williams

I'm a NEWBIE and have been struggling trying to get my head around modules
and functions and my 59 year old brain is on overload!!!! I have a module
that is called modPrint that prints a document from Word when I run it. I
want a command button to run the module but I know I need a function to call
the module but I can't figure out how to write the function. I've read
Running Microsoft Access and Que's Using Access 2000 but am lost. Back to
school??? Anyway can anyone explain in steps 1 2 3 how I do this??
TIA
Tony Williams
 
Hi Tony

First off, welcome. So you have a Module called modPrint. Now, more than
likely you have some kind of function declared inside that module, let's call
it MyFunction()

And you want to call the function when you click a button ... ok, in the On
Click event of the button simply enter the following:

Call MyFunction()

If you need additional help, please feel free to email AND post so all can
benefit.

Best regards and good luck

Maurice
 
Hello Tony,

Age is no excuse, I am 70 and still learning!

A module is just a collection of functions and subs that is not part of a
form or report.
So somewhere in your module I assume you have a function or sub that prints
the document.
If that sub or function is declared Public (The definition starts with
Public MySubName, where MySubName is the name of it, then you can call it
from anywhere in the database.
Just creade a form with a command button on it. When you add a command
button Access opens the Command Button Wizard which can help doing most of
the work, but in this case just cancel. Then, if it is not open, open the
form's Properties pane. Then click on the command button and, in the
Properties pane, click on the On Click box and select Event Procedure, then
click the little button to the right of the box and you will end up in the
VB editor in the sub for the command button. There you just type the name of
your sub or function. That's it!

BTW, Access comes with built in help that describes all of this and more.
If you are going to do a lot of work you could buy the Access 2000
developer's Handbook by Getz, Litwin and Gilbert, it is probably the best.

Ragnar
 
Thanks Ragnar I've tried looking at the help but got a bit lost!!! Patience
and perseverance is obviously the name of the game here. So I'll keep on
trying, inspired by you if you can still do it at 70 a young guy like me at
59 should find a it easy LOL
Thanks again
Tony
 
Thanks Maurice I think it's back to school for me, and thanks for the offer
of additional help. I'll take that up if I struggle
Tony
 
Back
Top