Value

S

Stout

I'm pretty new to this stuff but...

I want my "POWER" field to update based on which "MODEL" I choose. The
models are in a combo box in a different table which also holds the
power values.

Is it possible to do something like this:

me.power.value = tbl_model.watts.value

I keep getting: Run-Time Error '424' Object Required





Thanks
 
T

TNB

What you can do is something like this

me.Power.Value = dlookup("Watts","tbl_model","Model = '" & me.Model & "'")

The dlookup function looks for the Watts field in the tbl_model table WHERE
the field MODEL is equal to the model you selected in the me.field control

now notice that I included some ' sign surrounding the me.model. the
expression "Model = '" & me.Model & "'" results in a string with the
following contents:

Model = 'modelvalueyouselected'

This is added as a Where clause inside the dlookup function.

I hope this helped
 
S

Stout

Joseph, not a 100% sure what you mean. I am using this field in an
inventory database. I have the above code linked to an AfterUpdate of
the Model field so that when I add a new pc into the inventory, it will
update the Power field based on the selected model. This way I can see
what the total power usage is. Does this mean I am doing it
incorrectly?

Thanks for the help.
 
Top