By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,462 Members | 2,394 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,462 IT Pros & Developers. It's quick & easy.

Open Access from VB6 program

P: n/a
Can I open Access from a VB6 program, define Access path, system
path,
database path, user name & password for system.mdw ?

I tried the SHELL (code boew) and it works, but when I used it for
opening
Excel, sometimes I was facing problems. Then I used the CREATEOBJECT
and
everything is ok.

Dim var_process_number As Double 'return value for the window of
pkzip.exe
Dim var_a As String

var_a = """" & "C:\Program Files\Microsoft Office\Office\MSACCESS.EXE"
&
"""" & " "
var_a = var_a & "/wrkgrp" & " " & """" & "C:\System.MDW" & """" & " "
var_a = var_a & """" & "C:\My Programs\Open Access\aa1.mde" & """" & "
"
var_a = var_a & " /user " & " " & """" & "db_admin" & """" & " "
var_a = var_a & " /pwd " & " " & """" & "" & """" & " "

var_process_number = Shell(var_a, vbMaximizedFocus)

For Access I tried to use CREATEOBJECT to create application, but it
does
not allow me to change system.mdw path for defining mine with
SystemDB
property. After command is executes, SystemDB still points to
"C:\WINDOWS\system32\system.mdw". Is there a solution to this ?

Dim AcApp As Access.Application

Set AcApp = CreateObject("Access.Application")
AcApp.DBEngine.SystemDB = "C:\System\System.MDW"
AcApp.DBEngine.DefaultUser = "db_admin"
AcApp.DBEngine.DefaultPassword = ""
AcApp.Visible = True
AcApp.OpenCurrentDatabase cDatabaseToOpen

Feb 26 '07 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.