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

Open Access DB with VBA

Status
Not open for further replies.

mikeyd14

Technical User
Mar 20, 2007
3
US
Please let me know if I am in the wrong forum... I am trying to open one database from another using the code below. When I run this it opens an Access window, asks me the security question whether or not I want to open the database (which is normal) and when I click on "Open" it just disappears... any help would be appreciated.

Dim appAccess As Access.Application


Private Sub Command0_Click()

Dim strDB As String
Const strConPathToSamples = "U:\Daily Queries\SMA\"
strDB = strConPathToSamples & "Copy of Copy of Desktop SMA.mdb"
Set appAccess = _
CreateObject("Access.Application")
appAccess.OpenCurrentDatabase strDB
appAccess.DoCmd.OpenForm "ItWorks"
End Sub
 
You need to make appAccess visible. I am not sure I am right on the syntax, but I believe it is

Code:
appAccess.Visible = True

Hope this helps,

Alex

ps - you also should dispose of the object (appAccess) when you are done using set appAccess = nothing

Ignorance of certain subjects is a great part of wisdom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top