VB打开带工作组权限的Access

如果你打开一个数据库使用了Jet安全保护,你需要使用以下方式: 
Dim MyConn As New ADODB.Connection 
MyConn.Provider = "Microsoft.Jet.OLEDB.3.51 " 
MyConn.Properties( "Data Source ") = "C:\...\JetSecurity.MDB " 
MyConn.Properties( "Jet OLEDB:System database ") = "C:\...\System.MDW " 
MyConn.Open UserID:= "Admin ", Password:= "MyPwd " 

-或- 
Dim MyConn As New ADODB.Connection 
Dim strConn As String 
strConn = "Data Source=C:\...\JetSecurity.MDB; " & _ 
"Jet OLEDB:System database=C:\...\System.MDW " 
MyConn.Provider = "Microsoft.Jet.OLEDB.3.51 " 
MyConn.Open ConnectionString:=strConn, _ 
UserID:= "Admin ", Password:= "MyPwd " 

-或- 
Dim MyConn As New ADODB.Connection 
Dim strConn As String 
strConn = "Provider=Microsoft.Jet.OLEDB.3.51; " 
"Data Source=C:\...\JetSecurity.MDB; " & _ 
"Jet OLEDB:System database=C:\...\System.MDW " 
MyConn.Open ConnectionString:=strConn, _ 
UserID:= "Admin ", Password:= "MyPwd " 

你可能感兴趣的:(VB打开带工作组权限的Access)