Just a little update...I 've found a long winded way around it...
For some unknown reason....ItemBalance...wasn't appearing in the
underlying
'code'
by this I mean if I was in the On format event,and started typing Me.
ItemBalance....then after the . a list of methods or control sources
appear...
.ItemBalance was not in this list?
Although in the report design view if I clicked on Field List it appeared
there as well as in the control sourse property of a text box ?????
Therefore I used an Alias expression Balance:ItemBalance in the control
source query of the subreport, then it allowed me to refer to the 'Field'
Balance....I then added the following code on the Format event of the
subrep..
.
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If Me.Balance <> Me.Debit Then
If Me.Balance < 0 Then
Me.txtItemBalance = 0
Me.txtPostingType = " Payment (part of " & Me.Credit _
& ")"
Me.txtCredit = Me.Debit
Else
Me.txtItemBalance = 0
Me.txtPostingType = "Payment"
Me.txtCredit = Me.Credit
End If
Else
Me.txtItemBalance = Me.Debit
Me.txtPostingType = Null
Me.txtCredit = Null
End If
End Sub
I had to make the txtboxes unbound, therefore I had to bring Balance and
Credit controls back into the report in hidden textboxes....longwinded but
it
works!
Although I would be grateful of any simpler suggestions.
Hi Ken (and anybody else who could help me out!)
After standing back and looking at what I am trying to do I'm not too sure
it
is allowed....
The three text box control appear on a subreport detail section....inside
each (control source) is the following nested IIF
txtPostingType has this:
=IIf([Credit]>0,IIF([ItemBalance]<0,"Payment(part of " & Me.Credit & ")",
"Payment"),Null)
txtItemBalance has this:
=IIF([ItemBalance]=[Debit], [Debit],0)
and txtCredit has this:
=IIf([Credit]>0,IIf([ItemBalance]<0,[Debit],[Credit]),Null)
Debit, Credit, and ItemBalance are all currency data type.....
I think my problem lies in the fact I am trying to alter the textboxes
differently for each detail line, (I think)
is this allowed....if so how I tried similar code in the format event of
the
subreport....but had no joy
Thanks Graeme...
I don't see any obvious error in what you posted otherwise. Unless you
have
an embedded " character in the Me.Credit value?
[quoted text clipped - 4 lines]
could somebody please point out my error?