PDA

View Full Version : Excel and Access



john1234
11-05-2009, 06:22 AM
hi all i am sure that this have been ask may a time but i cannot seem to get it to work

i am just looking to open an access database from excel, that is it no sorting of find correct form etc.


Private Sub CommandButton8_Click()
Dim cn As ADODB.Connection
'Path to Access database
LPath = "F:\V2\V2\PL.mdb"
'Open Access and make visible
Set oApp = CreateObject("Access.Application")


'Open Access database as defined by LPath variable
oApp.OpenCurrentDatabase LPath

End Sub

this is what i have got so far but all it does it open and close down the db straight away

thanks for the help

MaximS
11-05-2009, 10:38 AM
try that:



Private Sub CommandButton8_Click()
Dim cn As ADODB.Connection
'Path to Access database
LPath = "F:\V2\V2\PL.mdb"
'Open Access and make visible
Set oApp = CreateObject("Access.Application")
oApp.Visible = True

'Open Access database as defined by LPath variable
oApp.OpenCurrentDatabase LPath

End Sub