A97 - 在BeforeUpdate事件期间查看输入文本框的值的最简单方法? [英] A97 - easiest way to have a look at a value entered into a textbox during the BeforeUpdate event?

查看:40
本文介绍了A97 - 在BeforeUpdate事件期间查看输入文本框的值的最简单方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

想要检查在BeforeUpdate事件期间在A97表单上输入文本框

的值。

文本框可能有也可能没有早期条目

之前的最新值,现在正在进行
进入。什么是引用即将更新文本框的

值的最佳方式?

Would like to examine the value entered into a textbox
on an A97 form during the BeforeUpdate event. The
textbox may or may not have had an earlier entry in it
prior to the latest value that is now in the process of
being entered. What''s the best way to refer to the
value just typed that is about to update the textbox?

推荐答案

只需使用价值。这是默认属性,所以你可以像

这样编码:


Private Sub BirthDate_BeforeUpdate(取消为整数)

如果Me.BirthDate>日期然后

取消=真

MsgBox未来出生? &安培; vbCrLf& _

"更正条目,或按< Esc>撤消。

结束如果

结束子


-

Allen Browne - 微软MVP。西澳大利亚州珀斯。

访问用户提示 - http:// allenbrowne.com/tips.html

回复群组,而不是mvps dot org的allenbrowne。


" MLH" < CR ** @ NorthState.net>在消息中写道

news:08 ******************************** @ 4ax.com ...
Just use the Value. That''s the default property, so you can just code like
this:

Private Sub BirthDate_BeforeUpdate(Cancel As Integer)
If Me.BirthDate > Date Then
Cancel = True
MsgBox "Born in the future?" & vbCrLf & _
"Correct the entry, or press <Esc> to undo."
End If
End Sub

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"MLH" <CR**@NorthState.net> wrote in message
news:08********************************@4ax.com...
想要检查在BeforeUpdate事件期间在A97表单上输入到文本框中的值。
文本框可能会或者可能没有在其中输入
的最新值之前的条目
。什么是引用即将更新文本框的
值的最佳方法?
Would like to examine the value entered into a textbox
on an A97 form during the BeforeUpdate event. The
textbox may or may not have had an earlier entry in it
prior to the latest value that is now in the process of
being entered. What''s the best way to refer to the
value just typed that is about to update the textbox?



我不是知道为什么我认为在AfterUpdate事件之前它不会是
。我想是Bonkers。将

立即尝试。

xxxxxxxxxxxxxxxxxxxxxxxxxxx
I don''t know why I thought it wouldn''t be there
until AfterUpdate event. Bonkers, I guess. Will
try now.
xxxxxxxxxxxxxxxxxxxxxxxxxxx
只需使用值。这是默认属性,所以你可以像
这样编码:

Private Sub BirthDate_BeforeUpdate(取消为整数)
如果Me.BirthDate>日期然后
取消=真的
MsgBox未来出生? &安培; vbCrLf& _
"更正条目,或按< Esc>撤消。
结束如果
End Sub
Just use the Value. That''s the default property, so you can just code like
this:

Private Sub BirthDate_BeforeUpdate(Cancel As Integer)
If Me.BirthDate > Date Then
Cancel = True
MsgBox "Born in the future?" & vbCrLf & _
"Correct the entry, or press <Esc> to undo."
End If
End Sub






On Tue,2005年11月1日11:39: 21 -0500,MLH< CR ** @ NorthState.net>写道:
On Tue, 01 Nov 2005 11:39:21 -0500, MLH <CR**@NorthState.net> wrote:
我不知道为什么我认为在AfterUpdate事件之前它不会在那里
。我想是Bonkers。将
立即尝试。
xxxxxxxxxxxxxxxxxxxxxxxxxxx
I don''t know why I thought it wouldn''t be there
until AfterUpdate event. Bonkers, I guess. Will
try now.
xxxxxxxxxxxxxxxxxxxxxxxxxxx



嗯,当然。你是对的。只是出于好奇,

的先前值是否为(1)以及在同一个BeforeUpdate事件(2)的

期间如何访问IT?我尝试了这个小片段......


私有子Text0_BeforeUpdate(取消为整数)

MsgBox Text0

昏暗响应为整数

响应= MsgBox(想要替换值?,vbYesNo,答案?)

如果响应= vbYes那么

退出Sub

否则

DoCmd.CancelEvent

SendKeys(" {esc}")

结束如果

结束子


假设某人输入了红色字样进入Text0控件。它坐在那里
,显示红色然后你进来并在其中键入Blue

并按Enter键。显示msgbox语句。

果然,你会看到蓝色字样。在盒子里。但点击

OK后,msgbox功能会提示您选择。您必须

接受或拒绝新的蓝色条目。如果单击是 -

过程结束,文本框现在显示蓝色。但是如果

你点击否,蓝色被丢弃并且红色被丢弃。回报。

的地方是红色暂时去,我可以在BeforeUpdate代码中从

读取这个值吗?


Well, of course. You were right. Just out of curiousity, where
does the prior value go (1) and how might IT be accessed during
that same BeforeUpdate event (2)? I tried out this little snippet...

Private Sub Text0_BeforeUpdate(Cancel As Integer)
MsgBox Text0
Dim Response As Integer
Response = MsgBox("Wanna replace the value?", vbYesNo, "Answer?")
If Response = vbYes Then
Exit Sub
Else
DoCmd.CancelEvent
SendKeys ("{esc}")
End If
End Sub

Say someone has entered "Red" into Text0 control. Its sitting
there, displaying "Red" and you come along and type "Blue"
into it and press Enter-key. The msgbox Statement displays.
Sure enough, you see "Blue" in the box. But after clicking
OK, the msgbox Function prompts you for a choice. You must
accept or reject the new entry of "Blue". If you click Yes - the
procedure ends and the textbox now displays "Blue". But if
you click No, "Blue" is discarded and "Red" returns. Where
did "Red" go temporarily and can I read THAT VALUE from
within the BeforeUpdate code as well?


这篇关于A97 - 在BeforeUpdate事件期间查看输入文本框的值的最简单方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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