|
本帖最后由 netguestcn 于 2014-8-31 15:59 编辑
Private Sub Command1_Click()
On Error GoTo Command1_Click_Err
Static acc As Access.Application
Dim db As DAO.Database
Dim strDbName As String
strDbName = CurrentProject.Path & "\B.mdb"
Set acc = New Access.Application
acc.Visible = True
Set db = acc.DBEngine.OpenDatabase(strDbName, False, False)
'Set db = acc.DBEngine.OpenDatabase(strDbName, False, False, "WD=123456")
acc.OpenCurrentDatabase strDbName
db.Close
Set db = Nothing
Command1_Click_Exit:
Exit Sub
Command1_Click_Err:
MsgBox Err.Description
Resume Command1_Click_Exit
End Sub |
|