需要按下按钮才能消失 [英] Need to make a button disappear upon condition

查看:63
本文介绍了需要按下按钮才能消失的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何制作按钮"上一页"在记录集和按钮"下一步"开始时消失。在Access 2010中的记录集结束时消失了吗?非常感谢您的帮助!

解决方案

您可以使用表单的On Current事件。假设命令按钮名为cmdPrevious和cmdNext:

 Private Sub Form_Current()
Me.cmdPrevious.Visible =(Me.CurrentRecord> ; 1)
Me.cmdNext.Visible =(Me.CurrentRecord< Me.Recordset.RecordCount)
End Sub

如果你愿意的话"下一个"按钮在最后一条现有记录上保持可见,但在用户移动到新记录时消失,将代码更改为

 Private Sub Form_Current()
Me.cmdPrevious.Visible =(Me.CurrentRecord> 1)
Me.cmdNext.Visible = Not Me.NewRecord
End Sub




How do I make a button "Previous" disappear upon the beginning of the recordset and button "Next" disappear upon the end of that recordset in Access 2010? Thanks so much for your help!

解决方案

You can use the On Current event of the form. Let's say the command buttons are named cmdPrevious and cmdNext:

Private Sub Form_Current()
    Me.cmdPrevious.Visible = (Me.CurrentRecord > 1)
    Me.cmdNext.Visible = (Me.CurrentRecord < Me.Recordset.RecordCount)
End Sub

If you'd like the "Next" button to remain visible on the last existing record, but disappear when the user moves to a new record, change the code to

Private Sub Form_Current()
    Me.cmdPrevious.Visible = (Me.CurrentRecord > 1)
    Me.cmdNext.Visible = Not Me.NewRecord
End Sub



这篇关于需要按下按钮才能消失的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆