我在MS Access表单上有一个多页面元素,我正在尝试使用GetArgs来识别使用以下代码打开哪个页面。任何人都可以帮助我如何将页面名称转换为MS Access将接受的格式?
Dim WrdArray() As String
If Not IsNull(Me.OpenArgs) Then
LoadAndLocation = Me.OpenArgs
WrdArray() = Split(LoadAndLocation, "|")
OriginalPage = WrdArray(1) 'This works and results in the correct page name eg Fina
Me.OriginalPage.SetFocus
End If
答案 0 :(得分:2)
不熟悉Access,所以可能有更简洁的方法,但我认为这正是你要找的。
Private Sub Tester()
SetTabByName Me.TabCtl0, "Second" 'set by Caption
SetTabByName Me.TabCtl0, "Page1" 'set by Name
End Sub
'Set tab control active page: match on tab name *or* caption...
Sub SetTabByName(tabCtrl As TabControl, sVal As String)
Dim x As Long
For x = 0 To tabCtrl.Pages.Count - 1
If tabCtrl.Pages(x).Name = sVal Or _
tabCtrl.Pages(x).Caption = sVal Then
tabCtrl.Value = x
Exit For
End If
Next x
End Sub