Gustavo Miller
New member
- Local time
- Today, 08:07
- Joined
- Jan 23, 2022
- Messages
- 10
Finally! Iwas able to figure out how to post!
Ok, the post title might be hard to understand. I got it.
I have a Microsoft Access database with a bunch of linked tables from SharePoint - Table Lists.
Now, here comes the tricky part. I have created this utility in Excel (which connect to the Access DB -mentioned above, using ADO). The database opens, but crashes when reading tables (any table).
Here is the code, it is pretty straight forward, Hope you can understand...
Set mCnn = CreateObject("ADODB.Connection")
With mCnn
.Provider = "Microsoft.ACE.OLEDB.12.0"
.ConnectionString = "Data Source=C:\NSDS\Excel Templates\Network Tracking Sheets\data\test.mdb;"
.Open
End With
Set mCmd = New ADODB.Command '<!-- Instantiate new Command object - Recordset object
mCmd.ActiveConnection = mCnn '<!-- Use active connection
mCmd.CommandType = adCmdText '<!-- Command type enumerator
mCmd.CommandText = "SELECT * FROM lkpProvinces"
Set mRS = New ADODB.Recordset '<!-- Instantiate new recordset
'mRS.CursorLocation = adUseClient
'<!-- Here is where it crashes... Excel locks and I have to kill the process
mRS.Open source:=mCmd ', CursorType:=adOpenDynamic
ConnectWBDatabase = True
I have tried different Providers but with no avail.
Work-around: this is not the optimal solution.
If I create an object, of type Access Application [CreateObject("Microsoft.Access")] I can access the tables using DAO, which is fine, I it runs. But, it requires that users have Access installed on their machines. Microsoft Access is a blocked application at the Government of Canada -I am a contractor with them. The application has 150 users, I would have to justify the installation of Access on their terminals. Not happening.
Ok, the post title might be hard to understand. I got it.
I have a Microsoft Access database with a bunch of linked tables from SharePoint - Table Lists.
Now, here comes the tricky part. I have created this utility in Excel (which connect to the Access DB -mentioned above, using ADO). The database opens, but crashes when reading tables (any table).
Here is the code, it is pretty straight forward, Hope you can understand...
Set mCnn = CreateObject("ADODB.Connection")
With mCnn
.Provider = "Microsoft.ACE.OLEDB.12.0"
.ConnectionString = "Data Source=C:\NSDS\Excel Templates\Network Tracking Sheets\data\test.mdb;"
.Open
End With
Set mCmd = New ADODB.Command '<!-- Instantiate new Command object - Recordset object
mCmd.ActiveConnection = mCnn '<!-- Use active connection
mCmd.CommandType = adCmdText '<!-- Command type enumerator
mCmd.CommandText = "SELECT * FROM lkpProvinces"
Set mRS = New ADODB.Recordset '<!-- Instantiate new recordset
'mRS.CursorLocation = adUseClient
'<!-- Here is where it crashes... Excel locks and I have to kill the process
mRS.Open source:=mCmd ', CursorType:=adOpenDynamic
ConnectWBDatabase = True
I have tried different Providers but with no avail.
Work-around: this is not the optimal solution.
If I create an object, of type Access Application [CreateObject("Microsoft.Access")] I can access the tables using DAO, which is fine, I it runs. But, it requires that users have Access installed on their machines. Microsoft Access is a blocked application at the Government of Canada -I am a contractor with them. The application has 150 users, I would have to justify the installation of Access on their terminals. Not happening.