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
 
G

Guest

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
 
J

Joseph Meehan

Stout said:
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

Are you storing the results of this calculation in a table? If so
naughty naughty. You should just compute it anytime you want to display it
or use it in a calculation.
 
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.
 
J

Joseph Meehan

Stout said:
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.

I guess that makes two of us, I am not 1005 of what you mean. :)

If you are storing the data that is used to compute a value, then you
should not store that value, but rather go back each time and let Access
re-compute it. It seems strange, but the computer likes it that way and it
can prevent miss-matches in the event on of the factors the result is based
on gets changed.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top