vba - 在不会更改的临时变量中捕获表值
问题描述
所以,假设我有这样的事情:
Do While Rec.EOF = False
'Capture the temp numbers right when you get to the new record, because the table values can change
ODN = Rec("OpenDayNumber")
CDN = Rec("CloseDayNumber")
If Rec("OpenDayNumber") >= X1 and =< Y1, then
'If the next record starts during the current one but ends after the current one...
If Rec("CloseDayNumber") > Y1, then
'Just set the OpenDayNumber of the following record to the CloseDayNumber of the current one
' so it doesn't double-count any days
Rec.Edit
Rec("OpenDayNumber") = Y1
Rec.Update
else
'Ignore Rec (X + 1), it occurred entirely during Rec X. Set its TotalPendDays to 0.
Rec.Edit
Rec("OpenDayNumber") = Rec("CloseDayNumber")
Rec.Update
end if
else
'its a legit new pend, and should be counted in its entirety
end if
X1 = ODN
Y1 = CDN
rec.MoveNext
Loop
如何让 X1 和 Y1 分别捕获 ODN 和 CDN 的值?一旦表中的数据发生变化,变量的值就会发生变化。嗯,Rec("CloseDayNumber")
永远不会改变,但Rec("OpenDayNumber")
可以改变。在进行任何更改之前,我希望 X1 等于 ODN 的值。
解决方案
推荐阅读
- apache-camel - 骆驼在处理文件之前验证校验和
- python-3.x - 在 Python3 的另一个类中使用枚举实例
- vba - 公共类型不能在类模块中声明
- python - 迭代 python 对象是 2.7。显示未找到错误
- javascript - 被服务器重定向后反应处理表单提交(带有数据)?
- python - python logger的后代-好处
- java - Spring Boot(用户''@'localhost'拒绝访问数据库'myappdb')
- python - TF Estimator:无法从保存的模型中加载 *.pb
- haskell - 我的记录字段名称与同一范围内的其他记录字段冲突
- php - 将命令作为变量传递时 proc_open 不起作用