The name of the module containing the procedure doesn't matter, but I
believe the procedure has to be a Function, not a Sub. You should be able
to change your Sub to a Function just by changing the keyword "Sub" to
"Function" in its declaration.
Having done that, create a new macro. To do that in Access 2003 or before,
go to the Macros tab of the database window and click the New button. To do
it in Access 2007, go to the Create tab on the Ribbon and click the Macro
button.
In the macro you are creating, choose the RunCode action for the first (and
only) macro action, and fill in the name of your function -- *with* trailing
parentheses, like this:
Data()
... in the Function Name argument. Then save the macro and give it a name
when prompted. You can't call it "Data", if that's the name of your
function, but you might call it "RunData". If you do name it that, then you
can revise your .bat file's command line like this:
"C:\Program Files\Microsoft Office\Office11\msaccess.exe" "C:\Documents
and Settings\Administrator\Desktop\simplestaticsimple.mdb" /x RunData
(That will have been broken onto two or more lines by the newsreader, butit
should be entered all on one line.
--
Dirk Goldgar, MS Access MVP
Access tips:
www.datagnostics.com/tips.html
(please reply to the newsgroup)