AcApp.CurrentProject.FullName Empty

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



I am calling the script below as follows:
wscript runmacro.vbs database_name.mdb macro_to_run

This has been working fine for over a year and now suddenly its stopped working. When I run the command I get the following wscript prompt:
Failed to open C:\company\datafeeds\database_name.mdb

I can only assume thats because AcApp.CurrentProject.FullName is empty but I can't figure out why. The pathing information all looks fine, the access db isn't being held open by any locks, the user I am running the script under has proper permissions.

Does anyone have any ideas?

Thanks
Brad



The contents of runmacro.vbs:
============================

Dim DBName, MacroName
DBName = "C:\company\datafeeds\" & WScript.Arguments(0)
MacroName = WScript.Arguments(1)

On Error Resume Next
Dim AcApp
Set AcApp = CreateObject("Access.Application")
If Val(AcApp.Version) >= 11 Then
'Turn off Warnings so the macros can run correctly.
AcApp.AutomationSecurity = 1
AcApp.SetOption "Confirm Action Queries", 0
AcApp.SetOption "Confirm Document Deletions", 0
AcApp.SetOption "Confirm Record Changes", 0
End If
AcApp.Visible = True
AcApp.OpenCurrentDatabase DBName

If AcApp.CurrentProject.FullName <> "" Then
AcApp.UserControl = True
Else
AcApp.Quit
MsgBox "Failed to open '" & DBName & "'."
End If
AcApp.DoCmd.RunMacro MacroName
acApp.CloseCurrentDatabase
AcApp.Close
AcApp.Quit
Set appAcc = Nothing

.



Relevant Pages

  • Re: Running a script using VB6 ScriptControl
    ... write some code to implememt the members of wscript ... All works well except that I need the script to "sleep" for a few seconds. ... Private Declare Sub apiSleep Lib "kernel32" Alias "Sleep" ... Public Property Let Parent ...
    (microsoft.public.scripting.vbscript)
  • Re: Running a script using VB6 ScriptControl
    ... > If you want to use WScript -- WRITE IT YOURSELF!!! ... > home-brew wscript object available to your script. ... > Public Property Let Parent ... > Public Sub Echo ...
    (microsoft.public.scripting.vbscript)
  • Re: Can using Wscript.StdOut.Write ?
    ... that refers to consoles by design, WScript doesn't support them. ... So if you launch your script by 'wscript bar.vbs' it won't work, ... An alias for the WScript-object is btw 'WSH' ...
    (microsoft.public.scripting.wsh)
  • Default Script Host
    ... My default Script Host magically changed from CScript to WScript. ...
    (microsoft.public.scripting.vbscript)
  • Re: Can using Wscript.StdOut.Write ?
    ... 'WScript.StdOut.WriteLine' will raise an error 'invalid file handle' ... that refers to consoles by design, WScript doesn't support them. ... So if you launch your script by 'wscript bar.vbs' it won't work, ... Any example for using cscript can allow arguments input? ...
    (microsoft.public.scripting.wsh)