Imdabaum
01-19-2010, 04:06 PM
:think: If I simply use the following code:
rs2.Fields("AmountOfBlahs") = rs.Fields(blah) * rs.Fields(blahblah) * (rs.Fields(blahdyblahblah)/100)
rs2 gets a value appended to the field and everything works fine and dandy.
But now let's say I have the following variables:
fee
timeframe
rate
I set each of these according to a record field because personally (be it laziness or early onset arthritis) I don't like typing rs.Fields(Blah) & rs.Fields(blahblah) & rs.Fields(blahdyblahblah) over and over again. Yes I do use these values repeatedly throughout multiple processes.
I end up with
Dim fee as Integer
Dim timeframe as Integer
Dim rate as Double
fee = rs.Fields(blah)
timeframe = rs.Fields(blahblah)
rate = rs.Fields(blahdyblahblah)/100
rs2.Field(AmountOfBlah) = fee * timeframe * rate 'breaks
This gives me an overflow error.
If I do a little switch-a-roo.
Dim fee as Integer
Dim timeframe as Integer
Dim rate as Double
fee = rs.Fields(blah)
timeframe = rs.Fields(blahblah)
rate = rs.Fields(blahdyblahblah)/100
rs2.Field(AmountOfBlah) = fee * rate * timeframe 'fixes
Code executes perfectly.
Educators: Can you explain why this is the case? Not sure whether to mark this solved as switching around the values did solve the problem. But the question is nevertheless still out there.
rs2.Fields("AmountOfBlahs") = rs.Fields(blah) * rs.Fields(blahblah) * (rs.Fields(blahdyblahblah)/100)
rs2 gets a value appended to the field and everything works fine and dandy.
But now let's say I have the following variables:
fee
timeframe
rate
I set each of these according to a record field because personally (be it laziness or early onset arthritis) I don't like typing rs.Fields(Blah) & rs.Fields(blahblah) & rs.Fields(blahdyblahblah) over and over again. Yes I do use these values repeatedly throughout multiple processes.
I end up with
Dim fee as Integer
Dim timeframe as Integer
Dim rate as Double
fee = rs.Fields(blah)
timeframe = rs.Fields(blahblah)
rate = rs.Fields(blahdyblahblah)/100
rs2.Field(AmountOfBlah) = fee * timeframe * rate 'breaks
This gives me an overflow error.
If I do a little switch-a-roo.
Dim fee as Integer
Dim timeframe as Integer
Dim rate as Double
fee = rs.Fields(blah)
timeframe = rs.Fields(blahblah)
rate = rs.Fields(blahdyblahblah)/100
rs2.Field(AmountOfBlah) = fee * rate * timeframe 'fixes
Code executes perfectly.
Educators: Can you explain why this is the case? Not sure whether to mark this solved as switching around the values did solve the problem. But the question is nevertheless still out there.