Access Report : Calculated field3 = field1 + field2

  • Thread starter Thread starter verb13
  • Start date Start date
V

verb13

I have 2 text fields in a report coming from a recordset. I want to
have a third field which will contain the result of some complex string
manipulation of the 2 fields. How can I achieve this? The idea is like
that:

Private Sub Report_Page()
Me.txtField3 = StringMalipulationFunction (txtField1, txtField2)
End Sub

(I don't know much about Access VBA)
 
I have 2 text fields in a report coming from a recordset. I want to
have a third field which will contain the result of some complex string
manipulation of the 2 fields. How can I achieve this? The idea is like
that:

Private Sub Report_Page()
Me.txtField3 = StringMalipulationFunction (txtField1, txtField2)
End Sub

(I don't know much about Access VBA)

'Complex string manipulation'?
It would have been nice to know what it is, as what is complex to you
might be quite simple to others and the answer different.

1) Set the control source of an unbound control ([txtField3]) to:
=StringMalipulationFunction (txtField1, txtField2)

no other code needed..

or.....

2) Page is not the correct event. It's too late in the report printing
process.
Place an unbound control in the report.
Let's say it's placed in the Detail section.

Code the Detail Format event:
Me![txtField3] = StringMalipulationFunction (txtField1, txtField2)
 
Back
Top