Assuming the code is already in a module, the easiest way would be to:
1. Make sure the routine you need to run is declared as a public function -
ie it starts with "Public Function". (If it's declared with the word
"Private" then change that to "Public". If it's a Sub then change Sub to
Function, and also change any "Exit Sub" statements to "Exit Function".
2. Create a command button on your form, and open its property sheet. Select
the "Events" tab and then enter the name of the function in the "On Click"
box. If the function is called "MyFunction" then you would have to enter
"=MyFunction()".
If you need to supply any arguments to the function then this won't work.
Post back if this is the case.
Andrea said:
MS Knowledge Base Article 149946 provided just the code we needed to solve
an importing problem we were having. However, none of us are programmers
and have no idea how to make the module easy to run for the users. We can
run it from the debug window and it works great, but how can we make it run
from a form with a button, or any other type of user-friendly interface
within access? We are using Access 97.