![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | AcApp.CurrentProject.FullName Empty 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 |
My System Specs![]() |
| | #2 (permalink) |
| | Re: AcApp.CurrentProject.FullName Empty Firstly comment out the On Error Resume Next. This should help if the real error is hidden. Then either use a proper debugger or add a messagebox to see whether AcApp is not Nothing and whether the CurrentProject is populated. -- Joe Fawcett (MVP - XML) http://joe.fawcett.name "Brad Baker" <brad@xxxxxx> wrote in message news 2175835-DE7E-4413-90F0-307349884335@xxxxxxQuote: >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 |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| (Empty) 'New' menu, empty start menu, BRAND NEW VISTA! | General Discussion | |||
| Vista explorer - Folder empty, but is not empty, why? | Vista General | |||
| copying file with a long fullname | PowerShell | |||
| dir -recurse | where { $_.FullName -match "[^ASP]" } | PowerShell | |||
| file folder icons display non-empty folders as empty | Vista file management | |||