Previous record fields

BobJones

Registered User.
Local time
Today, 18:32
Joined
Jun 13, 2006
Messages
42
Hi there, I'm trying to make a form which calculates the annual depreciation value of a property. I have tried using the PrevRecVal function and I even made the following query:

SELECT Last(PropertyDepreciation.[Total]) FROM PropertyDepreciation WHERE (((PropertyDepreciation.PropertyID)=(Forms!PropertyDepreciationSF!PropertyID)) And ((PropertyDepreciation.PDID)=((Forms!PropertyDepreciationSF!PDID)-1)));

But still no luck. I made a text field called PreviousTotalValue to see what sort of information was being returned by the query and PrevRecVal and for both, #Name? is returned.
Any ideas fellas?
Bob
 
PHP:
#Name

indicates an undefined control source. Check your spelling.
 
Just figured it out, in the query I was refering to the Depreciation form, as [Forms]![DepreciationSF] but it was a subform of [Property] so it should of been [Forms]![Property]![DepreciationSF]
Rookie mistake!
 
Beware using Last. It does not reliably return the record you want. Use Max on a field such as a date or an autonumber that will guarantee getting the latest reord.
 

Users who are viewing this thread

Back
Top Bottom