Excel/Access

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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:\fhs\listing\file1.mdb")
Set rst = dba.OpenRecordset("IA", dbOpenDynaset,
dbReadOnly)
Sheets("Form").Select
[a1].CopyFromRecordset rst
 
if you mean that database is password-protected - replace to this line:
Set dba = OpenDatabase("C:\fhs\listing\file1.mdb", False, False,
";pwd=MyPassword")
 
Back
Top