Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trouble scripting Access Application - Access.Run "MacroName" no work!

Status
Not open for further replies.

enoc6

Technical User
Jun 18, 2002
7
0
0
US
I am trying get access to automatically run a macro after the vbscript does some file name changes. Everytime I run this function I get an error message stating that Access cannot find the a module named Import. I tried converting the macro to a VBA module then ran the script again to access the module function and got the same error.

This is the function I am using to access the macro.
The script is run from a Windows 98 machine with access installed. The Access database resides on a local NT4.0 server. Any pointers?!


dim dbFortisImport
dbFortisImport= "\\NT4.0_ServerName\Apps\Electronic Transfer\Fortis Transfer.mdb"
dim macro
macro = "Import"
function runMacro(byval dbPath, byval macroName)
'on error resume next
Dim A
Set A = CreateObject("Access.Application")
A.Visible = true
A.OpenCurrentDatabase(dbPath)
A.Run macroName
if err.number <> 0 then
runMacro = &quot;Errors:&quot; & err.description & &quot;<br>&quot;
else
runMacro = &quot;Successful Execution of: &quot; & macroName & &quot; in &quot; & dbpath
end if
a.CloseCurrentDatabase
a.application.Quit
set a = nothing
End function
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top