petehilljnr
Registered User.
- Local time
- Today, 10:37
- Joined
- Feb 13, 2007
- Messages
- 192
Gidday,
From within Excel, I was asked if I could automate a process to extract data from an Access database that resides on a terminal server on our domain.
I can navigate to the server within our network through explorer ok.
I found the database I wanted to get into and tried to open it and it opened fine except it said it was read only and I couldn't make changes.
No problems so far because I just want to extract data, not change it.
So, I jump into Excel and write the following code to test connecting to that database.
Unfortunately, it fails on the OpenDatabase(dbPath) line.
The error reads:
Run-time error '3051'
The Microsoft Jet database engine cannot open the file "\\MyTerminalServer\Databases\DataTables\MyDatabase.mdb".
It is already opened exclusively by another user or you need permission to view its data.
Well ... scratch the "opened exclusively by another user" part because there isn't anyone using it.
So, I changed the line:
OpenDatabase(dbPath)
to
OpenDatabase(dbPath,False,False) (don't open exclusively and open read only)
Still no go. There are no passwords on the database either.
Any thoughts on how I can get into this table from Excel? I'm not particularly fussed about using or not using DAO, it's just what I know.
Other points to note:
I am able to "Link" to this table from within Access on my computer but can't change the data (and am not wanting to).
I can copy files from the directory on that server, but not write files to that directory.
When I log in to the terminal server using Remote Desktop, I have full permissions, but this is obviously different than if I navigate there using Windows Explorer.
Regards,
Pete
From within Excel, I was asked if I could automate a process to extract data from an Access database that resides on a terminal server on our domain.
I can navigate to the server within our network through explorer ok.
I found the database I wanted to get into and tried to open it and it opened fine except it said it was read only and I couldn't make changes.
No problems so far because I just want to extract data, not change it.
So, I jump into Excel and write the following code to test connecting to that database.
Code:
Sub test_link()
Dim dbs As DAO.Database
Dim rst As DAO.Recordset
Dim dbPath As String
dbPath = "\\MyTerminalServer\Databases\DataTables\MyDatabase.mdb"
Set dbs = OpenDatabase(dbPath)
Set rst = dbs.OpenRecordset("MyTable")
MsgBox rst.RecordCount
rst.Close
dbs.Close
End Sub
Unfortunately, it fails on the OpenDatabase(dbPath) line.
The error reads:
Run-time error '3051'
The Microsoft Jet database engine cannot open the file "\\MyTerminalServer\Databases\DataTables\MyDatabase.mdb".
It is already opened exclusively by another user or you need permission to view its data.
Well ... scratch the "opened exclusively by another user" part because there isn't anyone using it.
So, I changed the line:
OpenDatabase(dbPath)
to
OpenDatabase(dbPath,False,False) (don't open exclusively and open read only)
Still no go. There are no passwords on the database either.
Any thoughts on how I can get into this table from Excel? I'm not particularly fussed about using or not using DAO, it's just what I know.
Other points to note:
I am able to "Link" to this table from within Access on my computer but can't change the data (and am not wanting to).
I can copy files from the directory on that server, but not write files to that directory.
When I log in to the terminal server using Remote Desktop, I have full permissions, but this is obviously different than if I navigate there using Windows Explorer.
Regards,
Pete