G
Guest
Hi again!
I'm now updating a Budget table with the accumulated spending and am having
problems with using the variable name. The table is designed so that each GL
Code has its own row, with its Annual Budget, YTD Spending, Monthly Budgets
and Monthly Spendings. The YTDSpending updates fine because I can use the
name, but I am trying to use a variable name to update the Monthly Spendings
because I don't want 12 versions of this code! Here's the code:
Select Case rec("GLCode")
Case 5510
If accum5510 > 0 Then ' The accumulated
spending for this GL
curYTD = rec("YTDSpending")
curMonth = rec(strSpendName) ' strSpendName = JanSpend
in
' this
particular case.
With rec
.Edit
failing line -> !strSpendName = curMonth + accum5510
!YTDSpending = curYTD + accum5510
.Update
End With
End If
It fails with "Item not found in this collection" because it fails to
translate the value contained in the variable name, which is the table name
"JanSpend." I've tried parentheses, quotes and brackets.
Suggestions?
I'm now updating a Budget table with the accumulated spending and am having
problems with using the variable name. The table is designed so that each GL
Code has its own row, with its Annual Budget, YTD Spending, Monthly Budgets
and Monthly Spendings. The YTDSpending updates fine because I can use the
name, but I am trying to use a variable name to update the Monthly Spendings
because I don't want 12 versions of this code! Here's the code:
Select Case rec("GLCode")
Case 5510
If accum5510 > 0 Then ' The accumulated
spending for this GL
curYTD = rec("YTDSpending")
curMonth = rec(strSpendName) ' strSpendName = JanSpend
in
' this
particular case.
With rec
.Edit
failing line -> !strSpendName = curMonth + accum5510
!YTDSpending = curYTD + accum5510
.Update
End With
End If
It fails with "Item not found in this collection" because it fails to
translate the value contained in the variable name, which is the table name
"JanSpend." I've tried parentheses, quotes and brackets.
Suggestions?