且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

迷失焦点焦点我无法集中注意力

更新时间:2023-12-02 22:48:28


我正在尝试验证表单中的QTY条目,如果用户没有输入任何内容或0,我会提示输入一条消息并且光标返回到QTY输入栏。


我在数量上尝试了迷失焦点 -


如果qt​​y< = 0则

msgbox(请输入数量)

me.qty.SetFocus

结束如果


但光标总是跳到下一个输入框,我甚至替换为取消=真,它仍然无法工作,任何想法?



更改为After Update事件。

展开 | 选择 | Wrap | 行号


但是,如果用户按Tab键或将鼠标移离此文本框,那么我不认为更新后可以检测到它,我是对的吗?



但是,如果用户按Tab键或将鼠标移离此文本框,那么我不认为更新后可以检测到它,我是对的吗?



一旦输入控件,它应该触发更新后事件。但是,当然,您只需要在表单OnClose事件中调用该事件。

展开 | 选择 | Wrap | 行号


I am trying to validate a QTY entry in a form , if user did not enter anything or 0 , I will prompt for a message and the cursor return to the QTY entry column.

I have tried Lost Focus in the Qty -

If qty <=0 then
msgbox("Please Enter Qty")
me.qty.SetFocus
end if

But the cursor alway jump to the next entry box, I even replace with Cancel=true, it still doesnt work, Any Idea ?

I am trying to validate a QTY entry in a form , if user did not enter anything or 0 , I will prompt for a message and the cursor return to the QTY entry column.

I have tried Lost Focus in the Qty -

If qty <=0 then
msgbox("Please Enter Qty")
me.qty.SetFocus
end if

But the cursor alway jump to the next entry box, I even replace with Cancel=true, it still doesnt work, Any Idea ?

Change to After Update event.

Expand|Select|Wrap|Line Numbers


But what if user press the Tab key or move the mouse away from this text box, then I don''t think After Update could detect it, Am I Right ?


But what if user press the Tab key or move the mouse away from this text box, then I don''t think After Update could detect it, Am I Right ?

Once the control has been entered it should trigger the after update event. However, to be sure, you just have to call the event in the forms OnClose event.

Expand|Select|Wrap|Line Numbers


登录 关闭
扫码关注1秒登录
迷失焦点焦点我无法集中注意力
发送“验证码”获取 | 15天全站免登陆