0
我在MS Access 2010中有一個mainform。它有兩個子窗體,它們鏈接在一起。其中一個潛艇是「單一形式」,另一個是「數據表視圖」。在上面的Sub上,用戶可以看到記錄的細節,這在下面的子選擇。它工作正常。打開主窗體並轉到子窗體的記錄
我想從其他Access-App打開此Access-App,打開mainform並轉到特定記錄。這裏是代碼:
Dim appAccess As Access.Application
Set appAccess = CreateObject("Access.Application")
appAccess.OpenCurrentDatabase "C:\xxx\xxx\Desktop\MyAccess.accdb"
appAccess.DoCmd.OpenForm "subGridView", , , "[Number_X] = '" & Me.number_for_X.Value & "'"
它的工作原理,但我打開子窗體,這是在主要下面。我想,我需要這樣的:
Dim appAccess As Access.Application
Set appAccess = CreateObject("Access.Application")
appAccess.OpenCurrentDatabase "C:\xxx\xxx\Desktop\MyAccess.accdb"
appAccess.DoCmd.OpenForm "MAIN"
appAccess.DoCmd.GoToRecord acDataForm, "subGridView", acGoTo, 37
37只是一個測試參數......
或者類似的東西:
Dim appAccess As Access.Application
Dim rNr As String
Set appAccess = CreateObject("Access.Application")
rNr = Me.number_for_X.Value
appAccess.OpenCurrentDatabase "C:\xxx\xxx\Desktop\MyAccess.accdb"
appAccess.DoCmd.OpenForm "MAIN"
Forms!subGridView.Recordset.FindFirst "[Retoure_Nummer] = '" & rNr
Set appAccess = Nothing
請給我一些提示:-)
Greetz Vegeta_77