dragonslayer
New member
- Local time
- Yesterday, 21:33
- Joined
- Jan 31, 2012
- Messages
- 5
Hi, I am new to this forum an quite new microsoft access !
It may sound confusing but here we go:
Basically i have two tables (part of my car ad database) in which am utilising to perform a query/calculation/lookup - i don't know what to call it
The first table is called "car valuation" - and stores pre entered data on a cars:
(these are the fields)
CarValuationID (PK)
Make
Model
Type (SUV, sedan...)
RRP.
ValuationPrice (this is where i want the actual query to go)
The other table is called "Ad Car Details" and stores information on the users car in which they want to post
(these are the fields - that are relevant to the question)
AdCarDetailsID (PK)
CarValuationID (FK)
Make
Model
Type
YearOfProduction
The purpose of the valuation system is to analyse the make, model and type of car combination the user entered and match it with a corresponding "pre entered" combination (car valuation table). Obviously it is impossible to store every car on earth in a DB so if the combination of make model type that the user entered does not exist the valuation will not either (i.e. it will not appear on the form where the user will decide the price they wish to make for their car)
I lack skill in programming, however have made following expression in query builder (i don't know if this is the right thing to do)
- also when i try to run it, it says an error about parenthesis (or something along that line)
here is the expression i build (sorry for the length) - it is basically consists of a process to match the users fields with the pre stored ones then run a IIf function to calculate the appropriate value of the vehicle depending on the type and year it was made:
IIf ([AdCarDetails]![Type]=[CarValuation]![Type] And [AdCarDetails]![Make]=[CarValuation]![Make]And [AdCarDetails]![Model]=[CarValuation]![Model] , IIf ([CarValuation]![Type]in("sedan", "hatchback", "wagon"), [CarValuation]![RRP] - ((( (Year () - 1) - [AdCarDetails]![YearOfProduction]) * [CarValuation]![RRP] * 0.06) + (Year () -( Year () - 1)) * [CarValuation]![RRP] * .24) , IIf ([CarValuation]![Type] = "ute", [CarValuation]![RRP] - ((( (Year () - 1) - [AdCarDetails]![YearOfProduction]) * [CarValuation]![RRP] * 0.15) + (Year () -( Year () - 1)) * [CarValuation]![RRP] * .30), "" ) ) «Expr»
Please give me advice/alternatives to why it is not working and if it the most appropriate way to achieve the function...
Thanks, regards Sam
It may sound confusing but here we go:
Basically i have two tables (part of my car ad database) in which am utilising to perform a query/calculation/lookup - i don't know what to call it
The first table is called "car valuation" - and stores pre entered data on a cars:
(these are the fields)
CarValuationID (PK)
Make
Model
Type (SUV, sedan...)
RRP.
ValuationPrice (this is where i want the actual query to go)
The other table is called "Ad Car Details" and stores information on the users car in which they want to post
(these are the fields - that are relevant to the question)
AdCarDetailsID (PK)
CarValuationID (FK)
Make
Model
Type
YearOfProduction
The purpose of the valuation system is to analyse the make, model and type of car combination the user entered and match it with a corresponding "pre entered" combination (car valuation table). Obviously it is impossible to store every car on earth in a DB so if the combination of make model type that the user entered does not exist the valuation will not either (i.e. it will not appear on the form where the user will decide the price they wish to make for their car)
I lack skill in programming, however have made following expression in query builder (i don't know if this is the right thing to do)
- also when i try to run it, it says an error about parenthesis (or something along that line)
here is the expression i build (sorry for the length) - it is basically consists of a process to match the users fields with the pre stored ones then run a IIf function to calculate the appropriate value of the vehicle depending on the type and year it was made:
IIf ([AdCarDetails]![Type]=[CarValuation]![Type] And [AdCarDetails]![Make]=[CarValuation]![Make]And [AdCarDetails]![Model]=[CarValuation]![Model] , IIf ([CarValuation]![Type]in("sedan", "hatchback", "wagon"), [CarValuation]![RRP] - ((( (Year () - 1) - [AdCarDetails]![YearOfProduction]) * [CarValuation]![RRP] * 0.06) + (Year () -( Year () - 1)) * [CarValuation]![RRP] * .24) , IIf ([CarValuation]![Type] = "ute", [CarValuation]![RRP] - ((( (Year () - 1) - [AdCarDetails]![YearOfProduction]) * [CarValuation]![RRP] * 0.15) + (Year () -( Year () - 1)) * [CarValuation]![RRP] * .30), "" ) ) «Expr»
Please give me advice/alternatives to why it is not working and if it the most appropriate way to achieve the function...
Thanks, regards Sam