登录后打开特定的Navigationtab

问题描述 投票:0回答:1

在我的MS-Access数据库中,我有一个LoginForm,它检查用户是否具有对特定表单的访问权限。 我的主要,名为“NavigationsFormular”有4个标签Look of Navigationform正常用户可以访问名为“Bautagesbericht”的第一个标签。 ControlingUser可以访问第2,第3,第4个选项卡,但不能访问第1个选项卡!

登录表单是一个弹出窗口,我不想将其更改为选项卡,这将是丑陋而不是最佳。登录成功后,它会加载Navigationform。 对于普通用户来说没问题,但对于控制部分,它总是说“无法访问”,因为它试图打开一个他不被允许的标签。

这是代码btw:

    If Globals.UserAccess(Me.Name) = False Then
MsgBox " No access!"
DoCmd.Close acForm, Me.Name
End If

现在我的想法是,登录表单打开表单,用户通过以下代码获得权限:

If Globals.UserAccess("frm_Räumstellenerfassung") = False Then
DoCmd.BrowseTo ObjectType:=acBrowseToForm, _
ObjectName:="frm_Taetigkeitseingabe_Büro", _
PathToSubformControl:="Navigationsformular.NavigationsUnterformular>frm_Taetigkeitseingabe_Büro.NavigationsUnterformular"
DoCmd.Close acForm, Me.Name
Else
    DoCmd.OpenForm "Navigationsformular"
    DoCmd.Close acForm, Me.Name
    End If
End Sub

问题是路径不对.. Error

Mainform1 / MainFormular1 =“Navigationform” Subform1 / SubForm1 =“导航子窗体”(德文) Formular1 =“frm_Taetigkeitseingabe_Büro”

尝试所有组合没有任何帮助。

BTW:我的导航表单中的一个按钮与此代码一起工作。显然不是从其他形式尝试。

DoCmd.BrowseTo acBrowseToForm, "frm_Taetigkeitseingabe_Büro","Navigationsformular.NavigationsUnterformular"
vba ms-access access-vba
1个回答
0
投票

好吧,我跟着@ June7 tipps。感谢那。我的解决方案: 编辑我的表格“frm_Räumstellenerfassung”(Bautagesbericht)来

Private Sub Form_Open(Cancel As Integer)
   DoCmd.GoToRecord , , acNewRec
   If Globals.UserAccess("frm_Räumstellenerfassung") = False Then
   DoCmd.BrowseTo acBrowseToForm, "frm_Taetigkeitseingabe_Büro",    "Navigationsformular.NavigationsUnterformular"
   End If
End Sub

因此msg“No Access”不再弹出,如果用户无权查看此表单,则浏览到第二个选项卡(Tätigkeitserfassung),而不会看到第一个表单的任何详细信息。

我的登录按钮只是导航到导航表单

    DoCmd.OpenForm "Navigationsformular"
   DoCmd.Close acForm, Me.Name
© www.soinside.com 2019 - 2024. All rights reserved.