我有两个数据库A和B,现在打开A库的A11窗体,双击一个控件后希望打开B库中的B11窗体,并让数据记录定位与A11窗体记录相同,我用的代码是:
Dim objappAccess As New Access.Application
Dim strCN As String
strCN = "病历号 = [forms].[A11].[病历号]"
If AccessObject("B.mdb").IsLoaded = True Then
GoTo opdjgx
Else
objappAccess.OpenCurrentDatabase "F:\Case\B.mdb"
GoTo opdjgx
End If
opdjgx:
objappAccess.DoCmd.OpenForm "B11", , , strCN