H
Hydra
Sub DisplayTable()
Dim strDB As String
' Initialize string to database path.
Const strConPathToSamples = "C:\Database\" _
strDB = strConPathToSamples & "MSPData2"
' Create new instance of Microsoft Access.
Set appAccess = _
CreateObject("Access.Application")
' Open database in Microsoft Access window.
appAccess.OpenCurrentDatabase strDB
' Open table.
appAccess.DoCmd.OpenTable "MSPData"
End Sub
This throws an erroe at appAccess.OpenCurrentDatabase strdb which says the
file is missing or opened exclusively by another user.
Sure enough, If I go to explorer and try to open it, it will not open.
But, if I reset the code and then go to explorer and open the file, then it
opens normally.
It is as if the code was setting a lock on the file before it opens.
I have code that deletes the old database and makes a new on from scratch,
filling it with MSP data. All of that works.
But if I just want to open an existing file and append new data, then I
cannot open the file.
?????????????????????????????
Dim strDB As String
' Initialize string to database path.
Const strConPathToSamples = "C:\Database\" _
strDB = strConPathToSamples & "MSPData2"
' Create new instance of Microsoft Access.
Set appAccess = _
CreateObject("Access.Application")
' Open database in Microsoft Access window.
appAccess.OpenCurrentDatabase strDB
' Open table.
appAccess.DoCmd.OpenTable "MSPData"
End Sub
This throws an erroe at appAccess.OpenCurrentDatabase strdb which says the
file is missing or opened exclusively by another user.
Sure enough, If I go to explorer and try to open it, it will not open.
But, if I reset the code and then go to explorer and open the file, then it
opens normally.
It is as if the code was setting a lock on the file before it opens.
I have code that deletes the old database and makes a new on from scratch,
filling it with MSP data. All of that works.
But if I just want to open an existing file and append new data, then I
cannot open the file.
?????????????????????????????