G
Gray Sadler via AccessMonster.com
Hello everyone, Here's my problem:
I have a columnar subform, that's a child to a main Form. The subform is
based from a query that has certain criteria and the matches appear on my
subform. That all works like a charm, however here's where things get
weird. On the sub form there are 4 bound controls and one unbound control
which has an expression that calculates amounts that are in the 4 bound
objects. Here's my code:
<<code start>>
Dim total As Long
total = 0
If Not IsNull([Forms]![frmEditQsr]![subRepPay]!qtr1) Then
total = total + 1
End If
If Not IsNull([Forms]![frmEditQsr]![subRepPay]!qtr2) Then
total = total + 1
End If
If Not IsNull([Forms]![frmEditQsr]![subRepPay]!qtr3) Then
total = total + 1
End If
If Not IsNull([Forms]![frmEditQsr]![subRepPay]!qtr4) Then
total = total + 1
End If
[Forms]![frmEditQsr]![subRepPay]![qtrs] = total
<<code end>>
This code starts when a command button is clicked. After this code
executes, I get the same 'total' for every row, even though the figures are
different in each row. For example:
[should]
row [qtr1] [qtr2] [qtr3] [qtr4] [total] [ be ]
1 1 1 1 1 4 4
2 1 1 4 2
3 1 4 1
4 4 0
I know this is something so simple, but I'm drawing a blank. Any help would
be greatly appreciated!!!
I have a columnar subform, that's a child to a main Form. The subform is
based from a query that has certain criteria and the matches appear on my
subform. That all works like a charm, however here's where things get
weird. On the sub form there are 4 bound controls and one unbound control
which has an expression that calculates amounts that are in the 4 bound
objects. Here's my code:
<<code start>>
Dim total As Long
total = 0
If Not IsNull([Forms]![frmEditQsr]![subRepPay]!qtr1) Then
total = total + 1
End If
If Not IsNull([Forms]![frmEditQsr]![subRepPay]!qtr2) Then
total = total + 1
End If
If Not IsNull([Forms]![frmEditQsr]![subRepPay]!qtr3) Then
total = total + 1
End If
If Not IsNull([Forms]![frmEditQsr]![subRepPay]!qtr4) Then
total = total + 1
End If
[Forms]![frmEditQsr]![subRepPay]![qtrs] = total
<<code end>>
This code starts when a command button is clicked. After this code
executes, I get the same 'total' for every row, even though the figures are
different in each row. For example:
[should]
row [qtr1] [qtr2] [qtr3] [qtr4] [total] [ be ]
1 1 1 1 1 4 4
2 1 1 4 2
3 1 4 1
4 4 0
I know this is something so simple, but I'm drawing a blank. Any help would
be greatly appreciated!!!