ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Download (https://www.excelbanter.com/excel-programming/312047-download.html)

No Name

Download
 
Hello,

I am using the following code in VBA Excel to try and
download an Access table. The access table is password
protected and this code is an example of what I have used
in the past. How can I add the password to this code to
allow the table to download correctly?



Set dba = OpenDatabase("C:\his\l\K.mdb")
Set rst = dba.OpenRecordset("IA", dbOpenDynaset,
dbReadOnly)
Sheets("Form").Select
[a1].CopyFromRecordset rst

Jamie Collins

Download
 
wrote ...

I am using the following code in VBA Excel to try and
download an Access table. The access table is password
protected


I am aware of database security (password for the file) and workgroup
security (userID with password).

this code is an example of what I have used
in the past. How can I add the password to this code to
allow the table to download correctly?

Set dba = OpenDatabase("C:\his\l\K.mdb")
Set rst = dba.OpenRecordset("IA", dbOpenDynaset,
dbReadOnly)
Sheets("Form").Select
[a1].CopyFromRecordset rst


You can specify the password (and userID if applicable) in the
connection string. See:

http://msdn.microsoft.com/library/de.../D2/S5A2CF.asp

http://msdn.microsoft.com/library/de.../D2/S5A28B.asp

Jamie.

--


All times are GMT +1. The time now is 11:38 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com