你如何为逃生按钮做SendKey? [英] How do you do a SendKey for the escape button?

查看:96
本文介绍了你如何为逃生按钮做SendKey?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个表单以我有几个具有日期输入掩码的日期字段的形式调用报表。我创建了一个取消按钮:


Private Sub btnCancel_Click()

On Error GoTo Err_btnCancel_Click


Dim stDocName As String


DoCmd.Close


Exit_btnCancel_Click:

退出Sub


Err_btnCancel_Click:

MsgBox Error.Description

恢复Exit_btnCancel_Click


结束子


但是如果某人已经开始在日期字段中输入日期并且没有完成日期,则会出现错误框,您必须按退出键才能清除表单,然后才能使用取消按钮。我想让我的取消按钮清除表格,然后关闭它。我以为我可以做一个sendkey命令,但我不知道怎么做。


谢谢

Dan

解决方案

Dan。


尝试

< span class =codeLinkonclick =Blur(this,this.parentNode.parentNode,getChildren(this),true);>展开 | 选择 | Wrap | 行号



Dan。


尝试

展开 | < /跨度> 选择 | Wrap | 行号


很好。


尝试重新链接事件过程。
  • 在设计视图中打开表单
  • 打开按钮属性窗口
  • 转到[活动] - > [OnClick]
  • 选择[活动程序]
  • 点击[...]按钮

I have a form that calls up a report in the form I have several date fields that have date input masks. I have created a cancel button as:

Private Sub btnCancel_Click()
On Error GoTo Err_btnCancel_Click

Dim stDocName As String

DoCmd.Close

Exit_btnCancel_Click:
Exit Sub

Err_btnCancel_Click:
MsgBox Error.Description
Resume Exit_btnCancel_Click

End Sub

But if someone has started to enter a date in a date field and did not finish the date you get an error box and you have to press the escape key to clear the form before you can use the cancel button. I would like to have my cancel button clear the form and then close it. I thought I could do a sendkey command but I can''t figure out how.

Thanks
Dan

解决方案

Hi, Dan.

Try

Expand|Select|Wrap|Line Numbers


Hi, Dan.

Try

Expand|Select|Wrap|Line Numbers


Nice.

Try to relink event procedure.
  • open the form in design view
  • open the button properties window
  • goto [Events]->[OnClick]
  • select [Event Procedure]
  • Click on [...] button


这篇关于你如何为逃生按钮做SendKey?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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