需要有关更新文本框的帮助! [英] Need help on updating text box!

查看:73
本文介绍了需要有关更新文本框的帮助!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下查询,我正在计算一个数字来填写表格中的文本

框。代码有效,但我不能让文本框更新

,除非我更改记录,然后再回来。

我有一行Call GetCampDays在3个地方。

1.开始日期控制的After Update事件

2.结束日期控制的After Update事件

3.当前事件形式

任何人有任何其他想法?感谢您的帮助!!

Dim intTotalDays As Integer''计数器的天数

Dim dtmToday As Date''增加日期比较

dtmEnd = DateAdd(" d",-1,dtmEnd)''不算前一天

因此甚至不看它

intTotalDays = 0''从0天开始''我们有0天时间

开始

dtmToday = dtmStart

''InitiateCompare Date

Do dtmToday> dtmEnd

intTotalDays = intTotalDays + 1''Assum我们将计算


然后带我们的周末和假期

如果平日(dtmToday ,vbMonday)> 4然后''它是

周六或周日

intTotalDays = intTotalDays - 1''周末带一个

一天的周末

ElseIf Not IsNull(DLookup(" [Holidate]",Holidays",_

" [Holidate] =#"& dtmToday&"#") )然后''它是

aHoliday

intTotalDays = intTotalDays - 1''为假期带一个

dayaway

结束如果

dtmToday = DateAdd(" d",1,dtmToday)''添加一天

forNext比较

Loop

''直到dtmToday> dtmEnd

''所有日子都要比较

CalcWorkDays = intTotalDays''返回

价值

I have the following query and I am figuring a number to fill a text
box in a form. The code works but I cant get the text box to update
unless I change record stes and then come back.
I have the line Call GetCampDays is in 3 places.
1. The After Update event of the Start Date Control
2. The After Update event of the End Date Control
3. The Current event of the form
Anyone have any other thoughts? Thanks for help!!
Dim intTotalDays As Integer '' Counter for number of days
Dim dtmToday As Date '' To increment the date to compare
dtmEnd = DateAdd("d", -1, dtmEnd) ''don''t count last day
therefore don''t even look at it
intTotalDays = 0 ''Startwith 0 days '' We have 0 days to
start
dtmToday = dtmStart
''InitiateCompare Date
Do Until dtmToday > dtmEnd
intTotalDays = intTotalDays + 1 '' Assum we will count

then take our weekend and Holiday
If Weekday(dtmToday, vbMonday) > 4 Then ''It is
Saturdayor Sunday
intTotalDays = intTotalDays - 1 ''Take one
dayaway for weekend
ElseIf Not IsNull(DLookup("[Holidate]", "Holidays", _
"[Holidate] = #" & dtmToday & "#")) Then ''It is
aHoliday
intTotalDays = intTotalDays - 1 ''Take one
dayaway for the Holiday
End If
dtmToday = DateAdd("d", 1, dtmToday) ''Add a day
forNext Compare
Loop
''Until dtmToday > dtmEnd
''All days havebeen compared
CalcWorkDays = intTotalDays ''Return the
Value

推荐答案

我不完全理解你的问题,但你可以尝试在表单中使用

Me.Refresh或Me.Requery。 Me.Requery不会做任何好事

除非你有绑定控件。

I don''t fully understand your problem but you could try using
Me.Refresh or Me.Requery in your form. Me.Requery won''t do any good
unless you have bound controls.


我已经尝试了我能想到的一切得到它来更新。只有当我转到另一个记录集然后回来时才会更新
。那是

的问题。

I have tried everything I can think of to get it to update. It will
only update when I go to another record set and then back. Thats the
problem.


我看到了.Requery被建议,但是你试过......


Me.txtMyTextBox.Requery

-

Danny J. Lesandrini
dl ********* @ hotmail.com
http://amazecreations.com/datafast

" deercreek" < da*@deercreekcg.com>写了...
I see Me.Requery was suggested, but have you tried ...

Me.txtMyTextBox.Requery
--
Danny J. Lesandrini
dl*********@hotmail.com
http://amazecreations.com/datafast
"deercreek" <da*@deercreekcg.com> wrote ...
我已经尝试了所有我能想到的东西来让它更新。只有当我转到另一个记录集然后再回来时它才会更新。这就是
问题。
I have tried everything I can think of to get it to update. It will
only update when I go to another record set and then back. Thats the
problem.



这篇关于需要有关更新文本框的帮助!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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