fredfortsonsr
Registered User.
- Local time
- Today, 20:57
- Joined
- Apr 11, 2001
- Messages
- 15
Having an ARRAY problem and data mismatch - one may be causing the other.
This is my first venture into dealing with an array so I may have misinterpreted something in the things I've read.
My goal is simple (I think). I have a query that contains all the info I need to produce some calculations. I need to step thruough the records in the query and come up with two answers.
Answer one: The sum of a number and a running total based on a field in the query.
Answer two: I need to divide the running total by a set value obtained earlier in the program and store that in an array for later evaluation.
INFO:
[ConcentrationA] is data type TEXT
rawmatTTL is the recordcount of the query
Declarations:
Dim moleCounter as Single
Dim calcResult() as Variant
Dim dpDEGREE as Single
moleCounter = 0
With RstDewPoint
Do While True
For i = 1 To .rawmatTTL
If dpDEGREE <> 0 Then
moleCounter = moleCounter + [ConcentrationA]
ReDim Preserve calcResult(1 To rawmatTTL) As Variant
calcResult(i) = dpDEGREE / moleCounter
End If
.MoveNext
Next i
Exit Do
End With
As a result I am getting an endless loop that virtually locks up Access and I have to force the program closed. It appears to occur at the calcResult (i) section of the code.
So, my first attempt at an array has failed and I need someoen to please pull me from the mire.
Many Thanks
Fred
This is my first venture into dealing with an array so I may have misinterpreted something in the things I've read.
My goal is simple (I think). I have a query that contains all the info I need to produce some calculations. I need to step thruough the records in the query and come up with two answers.
Answer one: The sum of a number and a running total based on a field in the query.
Answer two: I need to divide the running total by a set value obtained earlier in the program and store that in an array for later evaluation.
INFO:
[ConcentrationA] is data type TEXT
rawmatTTL is the recordcount of the query
Declarations:
Dim moleCounter as Single
Dim calcResult() as Variant
Dim dpDEGREE as Single
moleCounter = 0
With RstDewPoint
Do While True
For i = 1 To .rawmatTTL
If dpDEGREE <> 0 Then
moleCounter = moleCounter + [ConcentrationA]
ReDim Preserve calcResult(1 To rawmatTTL) As Variant
calcResult(i) = dpDEGREE / moleCounter
End If
.MoveNext
Next i
Exit Do
End With
As a result I am getting an endless loop that virtually locks up Access and I have to force the program closed. It appears to occur at the calcResult (i) section of the code.
So, my first attempt at an array has failed and I need someoen to please pull me from the mire.
Many Thanks
Fred