Date Last Changed

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Please help.
I'm trying to produce a product price list from a table that records all the
price history for each item. The query should show only the last date it was
updated for each item in the list. This price would be the current price for
each item. How can I do this?

Any suggestions?
 
Thank you very much!

John Spencer (MVP) said:
So you have a price for each product for each customer. THen you will need to
change the sub-query to reflect that.
SELECT ...
AND PriceTable.Fecha = (SELECT MAX([Fecha]) FROM Price_Table as Temp
WHERE Temp.NDC = Price_Table.NDC AND
Temp.Customer=PriceTable.Customer)

Thank you very much this worked just fine:

SELECT Price_Table.*, [WAC]*(12+0.0000000001) AS DOZ
FROM Price_Table
WHERE (((Price_Table.Cliente)="Company1") AND ((Price_Table.Fecha)=(SELECT
MAX([Fecha]) FROM Price_Table as Temp WHERE Temp.NDC = Price_Table.NDC)));

But I still I have a problem: If I update the price for one customer the
item stop appearing in other customers lists. Any suggestions?

John Spencer (MVP) said:
One method:

SELECT YourTable.*
FROM YourTable
WHERE [Date] = (SELECT MAX([Date]) FROM YourTable as Temp WHERE Temp.Item = YourTable.Item)

FA wrote:

Correction
My table has:
"item" "date" "price" "category" "customer" "market" "product line"
"comments"

I want a query that show only the last date of each item.

:

Build the price history table.

PriceHistâ€â€*
ProductID – data type to match your existing fields
OldPrice – data type to match your existing fields
NewPrice – data type to match your existing fields
Update – Datetime field – default =Now() puts time tag as you may change
more than once in a day

Build an append query to append to PriceHist. Put this field in the design
view grid field row.
X : [Forms]![YourFormForPriceChange]![ProductID]
Y: [Forms]![YourFormForPriceChange]![OldPriceField]
Z: [Forms]![YourFormForPriceChange]![NewPriceField]

Create a macro that opens the above query and requery.

In your form that you would use to change prices, have a price field and new
price field that is unbound. In the new price field properties have it call
the macro on change.

Build a Totals query using the PriceHist table and Max the Update field.

Your product query would join product table and the Totals query on ProductID.


:

I can't find anything that helps.
Do I need to explain further? Please help.

:

See post "audit trail" or "history."

:

Please help.
I'm trying to produce a product price list from a table that records all the
price history for each item. The query should show only the last date it was
updated for each item in the list. This price would be the current price for
each item. How can I do this?

Any suggestions?
 

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

Similar Threads

select latest records 1
Dmax Function (I think!) 2
Dynamic Pivot Lookups 0
Last Date 3
Query corresponding to date range. 10
group query 1
Average Query 6
Getting info from two tables with disimilar headings 1

Back
Top