Convoluted Dlookup

S

Stryker22150

I have a query where I would like to capture the 2nd character in a
text field. The second part of this would be based on that value to
return the description. I have a lookup table that contains the 2
position and the description of the value I want. I have researched the

DLookup function however I am not sure if this is the right function to

use.


TIA
 
D

Duane Hookom

DLookup() might work but would probably not be the best solution. If you
provided the field and table names with sample data, this question would be
much easier to answer.

Assuming you have a lookup table tblColorCodes with ColorCode and ColorName
fields with records like:
R Red
W White
G Green
O Orange
Then in your main table you have a ProductCode field where the 2nd character
is a color code value. You can add tblColorCodes to your query with your
main table. Create a new column in the query:
Field: CCode: Mid([ProductCode],2,1)
Criteria: [ColorCode]

This query might not be editable. If you need to create an editable query as
the base for a form, remove tblColorCodes and the criteria. Then add a combo
box:
Control Source: CCode
Row Source: SELECT ColorCode, ColorName FROM tblColorCodes;
Column Count: 2
Bound Column: 1
Column Widths: 0,1
 
S

Stryker22150

Duane;

Thank you for the quick repsonse.

I guess I should have been more explicit in providing more detail.

Thanks.
 
Top