Windows Scripting: get default options for MS Access
Trying to find an Object property for Access to get the default file location so that I can script update it. Example: This grabs stuff from Word and tells me where the user file is, as well as the template paths
Const wdDocumentsPath = 0
Const wdWorkgroupTemplatesPath = 3
Set objWord = CreateObject("Word.Application")
Set objOptions = objWord.Options
Wscript.Echo "Word Documents Path: " & _
objOptions.DefaultFilePath(wdDocumentsPath)
Wscript.Echo "Word Workgroup Templates Path: " & _
objOptions.DefaultFilePath(wdWorkgroupTemplatesPath)
objWord.Quit
Trying to do something similar with Access.
0
a source to share
2 answers
Hmmm ... just looking quickly C:\Program Files\Microsoft Office\Office10\MSACC.OLB
(I'm using older access) with TLViewer.
Property Path As String [Get/o]
member of Access.CodeProject
Property Path As String [Get/o]
member of Access.CurrentProject
Property FullPath As String [Get/o]
member of Access.Reference
I have no idea if they are useful or not - I am not available much.
0
a source to share
There are two ways to do this. You can, as you said, get an accessor object and work with it:
Dim objAcc
Set objAcc = CreateObject("Access.Application")
objAcc.SetOption "Default Database Directory", "C:\Test"
objAcc.Quit
Or you can just change the value in the registry:
Dim WshShell
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Access\Settings\Default Database Directory", "C:\Test", "REG_SZ"
0
a source to share