Question : How do I change the content of the variable is the variable value is a string plus Numbers?

BPeriodS = Budget_Period2 and inside of the For Loop, I want it to increase to Budget_Period3, then Budget_Period4 and so on. Until I find a quantity.

What I am doing is to check in the Table Budget in the field Budget_Period__ has a quantity and if it has decrease it with wherever is in AmountActBdgt.
.


'substract the positive amount to the next Budget Period that has a quantity.
              AmountActBdgt = Amt - BAmountP
            For i = 0 To 24
                BudgetFound = .Fields(BPeriodS).Value
                If BudgetFound <> 0 And b > BudgetFound Then
                    BAmountNew = AmountActBdgt - BAmountS
                End If
           
                GoTo a
            Next i
            a  ' Finish the loop once the Budget with quantity is found

Answer : How do I change the content of the variable is the variable value is a string plus Numbers?

Try this.

/gustav
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
' Set rst = some recordset

AmountActBdgt = Amt - BAmountP
' b = ??
For i = 0 To 24
  BPeriodS = "Budget_Period" & CStr(i)
  BudgetFound = rst.Fields(BPeriodS).Value
  If BudgetFound <> 0 And b > BudgetFound Then
    BAmountNew = AmountActBdgt - BAmountS
    ' Exit loop.
    Exit For
  End If
Next i
Random Solutions  
 
programming4us programming4us