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 sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Use script to open database with runtime 1

Status
Not open for further replies.

MelissaKT

Technical User
Jun 22, 2004
95
US
I'm trying to use a script file to open my database. I found this script on the microsoft web site and it resets the security level to low and then opens the database. I need it to open the database with a runtime version. How exactly would I go about doing that? I would really appreciate any help.
Here is the script:
Code:
Const cDatabaseToOpen = "C:\Program Files\TaneyPO\TaneyPOSQL2003.ade"

On Error Resume Next
Dim AcApp 
Set AcApp = CreateObject("Access.Application")
If AcApp.Version >= 10 Then
     AcApp.AutomationSecurity = 1 ' msoAutomationSecurityLow
End If
AcApp.Visible = True
AcApp.OpenCurrentDatabase cDatabaseToOpen 
If AcApp.CurrentProject.FullName <> "" Then 
     AcApp.UserControl = True
Else
     AcApp.Quit
     MsgBox "Failed to open '" & cDatabaseToOpen  & "'."
End If

Thank you in advance.
[ponytails]
 
Save it in a text file called say, OpenDB.vbs
 
I don't guess I understand. Maybe I didn't explain very well. I have this saved in a .vbs file. However, It doesn't open it with the runtime version. I have the runtime version of Access 2003 installed on the my user's computers but this script file doesn't understand to use the runtime to open the database instead of the full version of access that they have. I hope this explains a little better.
 
Sorry I missed your point. It seems that automation is not supported.
Using automation causes a Run-Time Error when only the Microsoft Access Runtime is installed on a computer

You should be able to use shell:

[tt]Set WSHShell = CreateObject("WScript.Shell")
WSHShell.Run """C:\Program Files\Microsoft Office\Office\MSACCESS.EXE"" ""C:\Documents and Settings\Fionnuala\My Documents\Tek-Tips\db1.mdb"""[/tt]
 
That actually isn't an issue yet. All of my users currently have the full version of Access 2000. I'm the only one that has migrated to 2003. However, if this works out the way we want, the runtime could eventually be the only version on the machine. Soooo, I guess I'll deal with it now instead of later. [bigcheeks]

Anyway, I started working with the shell function that you provided, I appreciate your help. It isn't up and running yet but I really appreciate the push in the right direction.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top