Итак, допустим, у меня есть что-то вроде этого:
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 до внесения любых изменений.