John, Thank you for your reply...however, I can't do a combo box because we
have thousands of products, and I don't want the user to have to scroll
through the list to find each one...I copied your code into the control
source for Text227 like you said, and I keep getting an error...I had to make
a couple of changes to it, but this what I have:
=DLookUp("[PROD DESCR]","Z006","[EXCEPT PROD CODE1]" = " & [Text260]")
What am I doing wrong? Thanks again.
>>Hello, I'm trying to set up a form in which if a user types a product code
>>into one text box, in the next text box the product's description is returned.
[quoted text clipped - 36 lines]
>
> John W. Vinson[MVP]
AimeeK - 16 Nov 2005 19:58 GMT
I forgot to add that the "Z006" portion is the name of the table where the
product code would be "looked up" and then the product description would be
pulled over from this table.
>John, Thank you for your reply...however, I can't do a combo box because we
>have thousands of products, and I don't want the user to have to scroll
[quoted text clipped - 11 lines]
>>
>> John W. Vinson[MVP]
John Vinson - 16 Nov 2005 22:28 GMT
>John, Thank you for your reply...however, I can't do a combo box because we
>have thousands of products, and I don't want the user to have to scroll
>through the list to find each one...
Well, they don't really: if your product codes are well behaved, you
could use the Autocomplete option of the combo. Typing the first few
characters of the code (or of the description, if that's the first
visible field in the combo) will jump to that row in the combo box.
But you're right, thousands of rows is awfully big for a combo!
>I copied your code into the control
>source for Text227 like you said, and I keep getting an error...I had to make
[quoted text clipped - 3 lines]
>
>What am I doing wrong? Thanks again.
You have an extra doublequote after the = sign and another after the
[TEXT260]. Are the fieldnames in table Z006 in fact [EXCEPT PROD
CODE1] and [PROD DESCR]? What's the datatype of [EXCEPT PROD CODE1]?
If it's Number then you should have no delimiters:
=DLookUp("[PROD DESCR]","Z006","[EXCEPT PROD CODE1] = " & [Text260])
and if it's Text you need either singlequote delimiters
=DLookUp("[PROD DESCR]","Z006","[EXCEPT PROD CODE1] = '" & [Text260] &
"'")
or (if the code might contain an apostrophe) doublequote delimiters;
to enter a doublequote in a doublequote quoted string use a double
doublequote:
=DLookUp("[PROD DESCR]","Z006","[EXCEPT PROD CODE1] = """ & [Text260]
& """")
John W. Vinson[MVP]