open a secure database using vbs (1 Viewer)

virencm

Registered User.
Local time
Tomorrow, 04:59
Joined
Nov 13, 2009
Messages
61
hi guys
I have the following code that works and opens an access database. how do i pass my username and password to prevent the logon screen from popping up? The database uses the workgroup security.
any help would be appreciated. thanks in advance.
Cheers!

Set accDB = CreateObject("Access.Application")
accDB.visible = false
accDB.automationsecurity=1
accDB.OpenCurrentDatabase("C:\Documents and Settings\Administrator\My Documents\ltq database.mdb")
accDB.runmacro"mcrRefresh"
accDB.CloseCurrentDatabase
accDB.Quit
 

virencm

Registered User.
Local time
Tomorrow, 04:59
Joined
Nov 13, 2009
Messages
61
hi i can get the below code to work.. how do i add a command to run a macro after it opens access.


Set objConnection = CreateObject("ADODB.Connection")
Set accDB = CreateObject("Access.Application")
accDB.visible = false
objConnection.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:\Documents and Settings\Administrator\My Documents\ltq database.mdb;" & _
"Jet OLEDB:System Database=C:\Documents and Settings\Administrator\Desktop\Database\security1.MDW;" & _
"User ID=admin;Password=admin;"
 

KenHigg

Registered User
Local time
Today, 14:59
Joined
Jun 9, 2004
Messages
13,327
If you create a macro and name it 'Autoexec' it will run when the db opens.
 

Users who are viewing this thread

Top Bottom