combine field data

  • Thread starter Thread starter Rachel
  • Start date Start date
R

Rachel

I have two fields in my database that can sometimes
contain the same info; I have to keep them as seperate
fields because there is different calculations based on
each field.

How can I combine the data from the two fields on a
report when the data is the same? For instance, I want
a "total" field on my report that shows the sum of data
in txtPrice and txtDiscount when txtPriceCategory
= "Gift" and txtDiscountCategory = "Gift".

I have taken over this database from another developer
and cannot change the table structure at this point.
 
Hi,


Make a union query as appropriate and base de report on that query. The
union query can look like:


SELECT txtPriceCategory AS Category, txtPrice As Price FROM myTable

UNION ALL

SELECT txtDiscountCategory, txtDiscountPrice FROM myTable


You would then use a group on Category and SUM on Price.


Hoping it may help,
Vanderghast, Access MVP
 
Back
Top