Tom,
You need to replace "txtDescription" with the name of the control where you
want to display the parts description. Although I agree with John Vinson,
this should be an unbound control, so that you are not writing the same part
description in multiple places in your database.
Assuming that your PartNo field is a text field, then there are actually
three extra spaces in the DLOOKUP function below. I will copy what you are
using now, and right below it I will but an X in the spaces that needs to be
deleted. Compare the two and correct your code accordingly.
txtDescription = dlookup("Description", "tblParts", "[PartNo] = ' " &
txtPartNo & " ' ")
txtDescription = dlookup("Description", "tblParts", "[PartNo] = 'X" &
txtPartNo & "X'X")
HTH
Dale
Tom said:
txtDescription = dlookup("Description", "tblParts", "[PartNo] = ' " &
txtPartNo & " ' ")
This is the code I'm using. It is in the "after Update" on the "partNmbr"
box on the form.
Now I'm getting "The expression After Update that you entered as the
event
property setting produced the following error: The object doesn't contain
the automation object 'textDescription'
Dale Fye said:
Actually, he will need to remove the added space between the single and
double quotes before and after the reference to txtPartNo as well.
Dale
--
Don''t forget to rate the post if it was helpful!
Email address is not valid.
Please reply to newsgroup only.
Stuart McCall said:
Guess I should have been clearer.. I want the "Description" in the
description filed while keeping the part Number in the "part Number"
field
:
Im building a form and in the subform I want a "description" field
to
be
populated when I enter a "Part Number" in the field before it. I
have
a
separate table listing part numbers and their descriptions. It's
been
a
while and my memory is a bit rusty. Im working in Access 2000.
Thanx for your help
Tom
You could put a dlookup( ) in the afterUpdate event of the Part
Number
textbox/comboBox.
txtDescription = dlookup( "tblParts","Description","[PartNo] = ' " &
txtPartNo & " ' ")
OldPro's solution will work, so long as you pass the arguments in the
right
order. Instead of:
txtDescription = dlookup( "tblParts","Description","[PartNo] = ' " &
txtPartNo & " ' ")
use this:
txtDescription = dlookup("Description", "tblParts", "[PartNo] = ' " &
txtPartNo & " ' ")