Calculated controls in reports

G

Guest

Hi all

I’m having a nightmare trying to create a calculated control in a report.
The control’s value should be calculated from other controls. The only
problem is that there is no report event to which I can attach the code!

For example, the Report Open event occurs before the data loads – so the
calculation depends on data that hasn’t been loaded yet and therefore
generates an error.

With forms you don’t have this problem since forms offer the Form Current
event which occurs after the data is loaded.

Can anyone think of a way to get this to work?

Thanks

David
 
R

Rick B

Why do you need code to create a calculateed field? Just build an unbound
field and put your formula in the field. No code needed.

Rick B
 
G

Guest

Hi Rick

Thanks for your question. Because I want to use VB to generate the value.
The value will depend on a good deal of conditional logic, which would be
quite simple in VB and difficult if not impossible using the sort of syntax
possible for a control source (i.e. Iif).
 
M

Marshall Barton

David Cleave said:
I’m having a nightmare trying to create a calculated control in a report.
The control’s value should be calculated from other controls. The only
problem is that there is no report event to which I can attach the code!

For example, the Report Open event occurs before the data loads – so the
calculation depends on data that hasn’t been loaded yet and therefore
generates an error.

With forms you don’t have this problem since forms offer the Form Current
event which occurs after the data is loaded.


For reports, the events that occur as each data record is
processed are the Detail Section's Format and Print events.

Generally, you should use the Format event of the section
that contains the text box you want to calculate.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top