Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
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.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - AcApp.CurrentProject.FullName Empty

Reply
 
Old 11-05-2008   #1 (permalink)
Brad Baker


 
 

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 SpecsSystem Spec
Old 11-06-2008   #2 (permalink)
Joe Fawcett


 
 

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
news2175835-DE7E-4413-90F0-307349884335@xxxxxx
Quote:

>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 SpecsSystem Spec
Reply

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


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46