Hello Folks,
I am opening up an instance of Access and creating a table from a text file (Phoo.txt) from within VB6. However, when I go to shut down the Access Application from within MS Access itself, the database closes but the instance of Access remains open and will not close without terminating from the Task Manager.
Here is the code that we are using to open Access...help?
Public Sub OpenAccess()
'Use automation to open up MSAccess
Dim oAccess As Object
Dim db As Database
Dim ws As Object
Dim strMDBFileName As String
strMDBFileName = "C:\a_Phoo.mdb"
Set oAccess = CreateObject("Access.Application"
Set ws = oAccess.DBEngine.Workspaces(0)
On Error Resume Next
'**********************
Kill (strMDBFileName)
'**********************
Set db = ws.CreateDatabase(strMDBFileName, dbLangGeneral)
oAccess.OpenCurrentDatabase (strMDBFileName)
DoCmd.TransferText acImportDelim, , "zs_Phoo", "C:\a_Phoo.txt", True
oAccess.Visible = True
oAccess.CloseCurrentDatabase
Set db = Nothing
Set ws = Nothing
Set oAccess = Nothing
End Sub
Thanks
Graham and Mike
I am opening up an instance of Access and creating a table from a text file (Phoo.txt) from within VB6. However, when I go to shut down the Access Application from within MS Access itself, the database closes but the instance of Access remains open and will not close without terminating from the Task Manager.
Here is the code that we are using to open Access...help?
Public Sub OpenAccess()
'Use automation to open up MSAccess
Dim oAccess As Object
Dim db As Database
Dim ws As Object
Dim strMDBFileName As String
strMDBFileName = "C:\a_Phoo.mdb"
Set oAccess = CreateObject("Access.Application"
Set ws = oAccess.DBEngine.Workspaces(0)
On Error Resume Next
'**********************
Kill (strMDBFileName)
'**********************
Set db = ws.CreateDatabase(strMDBFileName, dbLangGeneral)
oAccess.OpenCurrentDatabase (strMDBFileName)
DoCmd.TransferText acImportDelim, , "zs_Phoo", "C:\a_Phoo.txt", True
oAccess.Visible = True
oAccess.CloseCurrentDatabase
Set db = Nothing
Set ws = Nothing
Set oAccess = Nothing
End Sub
Thanks
Graham and Mike