How to make a Calculated Field

T

tarweesh

hi, i am using Microsoft Access 2007 and i want to make a calculated
field to be able to sort the table by this field.
for example if i have a table with 5 fields (title, f1, f2, f3, total)
i am going to enter the values of title, f1, f2 and f3; i want the
field "total" to be calculated automatically (f1+f2+f3) then i want to
display the table sorted by the value of the total field.
i tried looking in other topics but what i understood from most of them
that this is not possible to create a calculated field in the same
table of the fields used in the calculation, if it's really not
possible does anyone have any idea how to do what i want without
manualy entering the value of "total". by the way i am using PHP to
access the database.
 
D

David F Cox

This might do what you want, if I have readi it right.
in QBE grid:-

x: [field1]+[field2]+[field3]

and sort on it.
 
J

John Vinson

hi, i am using Microsoft Access 2007 and i want to make a calculated
field to be able to sort the table by this field.

Don't bother trying to sort a TABLE - use a Query instead. A Table is
an unordered heap of data; queries are where you select, arrange and
sort information.
for example if i have a table with 5 fields (title, f1, f2, f3, total)
i am going to enter the values of title, f1, f2 and f3; i want the
field "total" to be calculated automatically (f1+f2+f3) then i want to
display the table sorted by the value of the total field.

Create a Query based on the table. In a vacant Field cell, type

Total: [F1] + [F2] + [F3]

In the Sort row underneath this, select Ascending (or Descending if
you prefer).
i tried looking in other topics but what i understood from most of them
that this is not possible to create a calculated field in the same
table of the fields used in the calculation, if it's really not
possible does anyone have any idea how to do what i want without
manualy entering the value of "total". by the way i am using PHP to
access the database.

Access the Query, rather than the Table.

John W. Vinson[MVP]
 
T

tarweesh

Thanks, that was helpful.

John said:
hi, i am using Microsoft Access 2007 and i want to make a calculated
field to be able to sort the table by this field.

Don't bother trying to sort a TABLE - use a Query instead. A Table is
an unordered heap of data; queries are where you select, arrange and
sort information.
for example if i have a table with 5 fields (title, f1, f2, f3, total)
i am going to enter the values of title, f1, f2 and f3; i want the
field "total" to be calculated automatically (f1+f2+f3) then i want to
display the table sorted by the value of the total field.

Create a Query based on the table. In a vacant Field cell, type

Total: [F1] + [F2] + [F3]

In the Sort row underneath this, select Ascending (or Descending if
you prefer).
i tried looking in other topics but what i understood from most of them
that this is not possible to create a calculated field in the same
table of the fields used in the calculation, if it's really not
possible does anyone have any idea how to do what i want without
manualy entering the value of "total". by the way i am using PHP to
access the database.

Access the Query, rather than the Table.

John W. Vinson[MVP]
 
T

tarweesh

i created the query and saved it in the database, now how to access
this query in PHP ???
i tried to use it in a SELECT statement like a table but it didn't
work.

John said:
hi, i am using Microsoft Access 2007 and i want to make a calculated
field to be able to sort the table by this field.

Don't bother trying to sort a TABLE - use a Query instead. A Table is
an unordered heap of data; queries are where you select, arrange and
sort information.
for example if i have a table with 5 fields (title, f1, f2, f3, total)
i am going to enter the values of title, f1, f2 and f3; i want the
field "total" to be calculated automatically (f1+f2+f3) then i want to
display the table sorted by the value of the total field.

Create a Query based on the table. In a vacant Field cell, type

Total: [F1] + [F2] + [F3]

In the Sort row underneath this, select Ascending (or Descending if
you prefer).
i tried looking in other topics but what i understood from most of them
that this is not possible to create a calculated field in the same
table of the fields used in the calculation, if it's really not
possible does anyone have any idea how to do what i want without
manualy entering the value of "total". by the way i am using PHP to
access the database.

Access the Query, rather than the Table.

John W. Vinson[MVP]
 

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