Joined Tables

  • Thread starter Thread starter Fraelorn
  • Start date Start date
F

Fraelorn

I'm trying to create a calculation of two fields in the design view within
Access. I'm trying to perform a division calculation of one field, by
another, Can anyone give me some pointers on where to start? I'm not super
familiar with the syntax allowed to perform this...
 
Are you talking about design view of a query or a form/report?

If it's a query, then in the "Field" cell first blank column, enter your
calculation like this:
FieldName: Expression
For example:
AvgSpeed: [Distance] / [Time]

If it's a calculated control on a form or report, then enter the expression
after an "=" sign in the Control Source property of a textbox:
= [Distance] / [Time]

If there's a possibility of the divisor field being zero, then use a
conditional expression:
IIf( [Time]<>0, [Distance] / [Time], Null )
 
To divide a field named F1 by a field named F2, start by typing this
expression into the Field row in query design:
[F1] / [F2]

That will yield an error if you try to divide by zero, this would be better:
IIf([F2]=0, Null, [F1] / [F2])
 
I'm trying to create a calculation of two fields in the design view within
Access. I'm trying to perform a division calculation of one field, by
another, Can anyone give me some pointers on where to start? I'm not super
familiar with the syntax allowed to perform this...

You can't do this in a Table, if that's what you want. Tables are not
spreadsheets, though they might look like one!

To display a calculation in a Form, create a new textbox on the form and set
its Control Source property to


=[Thisfield] / [Thatfield]

using the names of fields in the form's recordsource (or if you prefer, the
names of other controls on the form).
 
Back
Top