Calculated Field

P

pjd

Hi

Is it possible to make a calculated filed on a form?

E.g. On my form I have the following fileds; [Sub Total], [VPT], [GST],
[Stamp Duty].

I would like a field on my form to show the sum of these to ensure that the
operator has entered the break up correctly. How Can I do this?
Is it possible??
 
J

John Vinson

Hi

Is it possible to make a calculated filed on a form?

E.g. On my form I have the following fileds; [Sub Total], [VPT], [GST],
[Stamp Duty].

I would like a field on my form to show the sum of these to ensure that the
operator has entered the break up correctly. How Can I do this?
Is it possible??

Not only possible, but easy.

Put a textbox on the form; call it txtSum say.

Set its Control Source property to

=[Sub Total] + [VPT] + [GST]

If any of the fields might be NULL (empty), use instead

=NZ([Sub Total]) + NZ([VPT]) + NZ([GST])

John W. Vinson[MVP]
(no longer chatting for now)
 
M

Mike Painter

pjd said:
Thanks for the reply.

The form is based on a table.

If you base the form on a query with the calculation in it then you can use
that query for all other forms and reports.
If you don't, then you have to duplicate the calculation on each form and
report and hope you don't make any mistakes or have to change all of them.


thanks

Joseph Meehan said:
pjd said:
Hi

Is it possible to make a calculated filed on a form?

E.g. On my form I have the following fileds; [Sub Total], [VPT],
[GST], [Stamp Duty].

I would like a field on my form to show the sum of these to ensure
that the
operator has entered the break up correctly. How Can I do this?
Is it possible??

One way, if the form is based on a query is to add a new field
to the query like

NEWTOTAL: [Sub Total] + [VPT] + [GST] + [Stamp Duty]
 
D

Damien McBain

pjd said:
Thanks for the reply.

The form is based on a table.

thanks

Joseph Meehan said:
pjd said:
Hi

Is it possible to make a calculated filed on a form?

E.g. On my form I have the following fileds; [Sub Total], [VPT],
[GST], [Stamp Duty].

I would like a field on my form to show the sum of these to ensure
that the
operator has entered the break up correctly. How Can I do this?
Is it possible??

Make a new textbox and make the ControlSource a formula like (in this
example a gross magin percentage calc):
=([Sales]-[COS]+[Rebates])/[Sales]

The value in the calculated textbox won't change though until you change
records so you may have to create some event subs (afterupdate of onchange)
to "Recalc" the form (look this up in F1 VBA help) after some of the other
fields are updated.

Having said that, I prefer to base all my forms and reports on queries
because the query allows me to arrange the data better (sorting & calcs etc)
than a table and is more flexible than the same functionality on a form
(filtering and SortBy).

HTH

Damo
 
Top