Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using Domain Aggregate Function in an IIf Statement 1

Status
Not open for further replies.

pjd218

Technical User
Apr 14, 2008
40
US
Any guidance on syntax?

What I am trying to do is to lookup the last value in a related table based on a field(DateChange)and then use another value(s)to perfom misc. calcs on a form, report, and query.

I do not want to affect any values older than the ChangeDate
 
Remou,

DMax works to pull the most recent ChangeDate, but I then need to pull a field from that record to perfom a calculation.

Any suggestions?
 
DLookUp("[a field]","yourTable","ChangeDate=#" & DMax(...) & "#")

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
PHV

Thanks for the suggestion. Appears to be working.

However, if I have a price change date from the PriceTBL for month other than the current month, getting an Error? on the calculation. Code follows:

=[BagIceSales]/DLookUp("[BagIcePrice]","PriceTBL","ChangeDate=#" & DMax("ChangeDate","PriceTBL","[ChangeDate]<=Forms!SalesFRM![SalesDate]") & "#")
 
Hopefully ChangeDate and SalesDate are real dates ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
PH,

Nice work.

Seems to do the trick. Not sure about that error but I may have been looking at the wrong field. Too tired.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top