office交流网--QQ交流群号

Access培训群:792054000         Excel免费交流群群:686050929          Outlook交流群:221378704    

Word交流群:218156588             PPT交流群:324131555

access用按钮实现选项卡的页移动

2018-03-02 16:25:00
tmtony8
原创
9342

在access中,选择卡控件可以设计多个页来显示内容。点击不同的页可以显示页中不同的内容

有时当选项卡选项页比较多的时候, 我们可以通过按钮的第一页,上一页,下一页,最后一页来切换页面操作。


如图窗体上添加名为“选项卡控件2”的选项卡控件,设置4个页面移动的按钮分别为“Command6”,"Command7","Command8","Command9"


详细代码如下:

Private Sub Command6_Click()
    If Me.选项卡控件2.Value <= Me.选项卡控件2.Pages.Count - 1 Then
        Me.选项卡控件2.Pages(0).SetFocus
    End If
End Sub

Private Sub Command7_Click()
    If Me.选项卡控件2.Value > 0 Then
        Me.选项卡控件2.Pages(Me.选项卡控件2.Value - 1).SetFocus
    End If
End Sub

Private Sub Command8_Click()
    If Me.选项卡控件2.Value < Me.选项卡控件2.Pages.Count - 1 Then
        Me.选项卡控件2.Pages(Me.选项卡控件2.Value + 1).SetFocus
    End If
End Sub

Private Sub Command9_Click()
    If Me.选项卡控件2.Value <= Me.选项卡控件2.Pages.Count - 1 Then
        Me.选项卡控件2.Pages(Me.选项卡控件2.Pages.Count - 1).SetFocus
    End If
End Sub

当点击“第一页”时,页面来到第一页,其他同理。操作非常方便。



    分享