K
krzysztof via AccessMonster.com
Good Afternoon.
i am going nuts trying to figure this problem.
i have a column of text boxes that can contain a integer, decimal, zero or
null.
i want to look at each txt box and i there is something in it, mark a tally
and capture the value in the box, then do a running sum of the value.
i did a check on the variables, at each step in the loop, and the variables
are ok, they have the right values.
here is my code
Dim counter As Integer
Dim notempty_emg As Single
Dim CellValue As Single
Dim kpiemg As Single
kpiemg = 0
notempty = 0
For counter = 0 To 12
LocationID = North(counter, 0)
If Me.Form("kpi_emg_" & LocationID) = 0 Or Me.Form("kpi_emg_" &
LocationID) = "" Or IsNull(Me.Form("kpi_emg_" & LocationID)) = True Then
'Skip to next element in my array
Else
CellValue = Me.Form("kpi_emg_" & LocationID)
kpiemg = kpiemg + CellValue
notempty = notempty + 1
End If
Next counter
Me.kpi_emg_total = kpiemg / notempty_emg 'put the average in
another textbox
the kpiemg variable value is 5, and the notempty_emg value is: 3
This should just be an easy division. both variables are of the same
type, but i keep getting Error 11: Division by Zero.
What's happening to my variable outside the loop??
VMTIA~
K
i am going nuts trying to figure this problem.
i have a column of text boxes that can contain a integer, decimal, zero or
null.
i want to look at each txt box and i there is something in it, mark a tally
and capture the value in the box, then do a running sum of the value.
i did a check on the variables, at each step in the loop, and the variables
are ok, they have the right values.
here is my code
Dim counter As Integer
Dim notempty_emg As Single
Dim CellValue As Single
Dim kpiemg As Single
kpiemg = 0
notempty = 0
For counter = 0 To 12
LocationID = North(counter, 0)
If Me.Form("kpi_emg_" & LocationID) = 0 Or Me.Form("kpi_emg_" &
LocationID) = "" Or IsNull(Me.Form("kpi_emg_" & LocationID)) = True Then
'Skip to next element in my array
Else
CellValue = Me.Form("kpi_emg_" & LocationID)
kpiemg = kpiemg + CellValue
notempty = notempty + 1
End If
Next counter
Me.kpi_emg_total = kpiemg / notempty_emg 'put the average in
another textbox
the kpiemg variable value is 5, and the notempty_emg value is: 3
This should just be an easy division. both variables are of the same
type, but i keep getting Error 11: Division by Zero.
What's happening to my variable outside the loop??
VMTIA~
K