Hello I am using MS Access 2007
I have a table called Extraction Line it is similar to an order line table , within this table are the two fields of concern:
Field: Tonnage:Number data type
Field: worth:Currency data type
What I want to happen is
As soon a user enters the tonnage value
In the afterupdate event for the tonnage field a Dlookup will look at the Resource table and find the Price field (currency data type) It then multiplies the Resource table Price value with the tonnage amount field (e.g) $50 x 5 etc, the $250 value is then added to the worth field.
So far I cannot even get success on using dlookup to get a value from the resource table
My code is in the extraction line form at the afterupdate event for the tonnage field:
Private Sub Tonnage_AfterUpdate()
Dim X As Currency
X = DLookup("[Price]", "[Resource]", "Atomic Number" = "076")
'X= Nz(DLookup("[Price]", "[Resource]", "Atomic Number" = "076"), 0)
'X = DLookup("[Price]", "[Resource]", "[Atomic number] = Form![Atomic number]") * [Worth]
I wanted to test the simple part of get a value first before doing the multiply and the rest of the requirements but keep getting Null value errors.
I think I am getting Null value errors due to this explanation Null Value is due to...
But of course there will be no value or nothing there as I want dlookup to go get the value first then carry out the maths.
Prior to this way I tried various validation rules within the Extraction Line form but received ?Name errors.
What is the best way to achieve the above. If I can get help to point me in the right direction I can go away and attempt this.