Link to home
Start Free TrialLog in
Avatar of shambalad
shambaladFlag for United States of America

asked on

Table Definition - Set lookup values based on another field in table

I am working on an Access 2010 database (32 bit, accdb). Within this database I am attempting to create a dynamic data validation process, wherein the user can identify fields in tables they want validated, and define what they want those fields validated against.
I have two tables in this database listing the tables in the database that will be validated plus the table(s) that will be used for validation, and all of the fields in these selected tables (tblDdTable and tblDdField, respectively).
I am now creating a new table named tblDdRules. One of the fields in this new table is "TableName". This field is defined with a combobox lookup which queries the table names in tblDdTable. The next field is "FieldName". I would like to define a combobox lookup which queries tblDdField using the value in the prior field "TableName" as the key.
I am attaching a small database with the three tables mentioned in the first post.
Here is an image of the lookup defined for the TableName field. How would I set up the query for the FieldName lookup?
User generated imageLookup-Question.accdb
ASKER CERTIFIED SOLUTION
Avatar of Jeffrey Coachman
Jeffrey Coachman
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of shambalad

ASKER

Duly noted. I know how to do this on a form.
Won't someone simply tell me how this is done in a table definition?
I have to apologize. I've managed to get two questions running concurrently on the same topic. I closed out the other, but then the Expert responded with more input. I am going to close out this question and focus the discussion on the earlier question.
https://www.experts-exchange.com/questions/27670012/Table-Definition-Set-lookup-values-based-on-another-field-in-table.html
I just posted this in the other question:
FWIW:
Some years ago I was supporting multiple Access databases for a major Health insurer. The individual who originally created the databases had extensively used lookups in the table definitions, so I know just how much of a major PITA they can be.
I still want to know how I can create a lookup which filters based on the value of another field in the table.
Then this will take a bit of work.
Unfortunately, I just can't spare the time to do this as a volunteer here..

Sorry, Perhaps another Expert will help out
You're right. It's not worth it. As I develop, I sometimes digress into what amount to more intellectual efforts than anything else. This would fall into that category.
I know these lookups are impractical for client databases, but it could be a useful tool for me personally.
Thanks anyway.
th
<I know these lookups are impractical for client databases, but it could be a useful tool for me personally.>
That is what I though as well, ...at one time...

In addition to what the link states...
You cannot paste the visible text or the numerical value directly into the combobox/field.
Alos, this "Datatype" is not currently supported by SQL Server, so it will be worthless, when you need to upsize


It is far beter "for your own understainding" to keep the data as "raw" as possible in the tables...


In this same vein, do as much research as you can before using other "Access only" features:
Multivalues fields
Hyperlink Fields
OLE fields
Attachment fields
...etc

These all have their place *In MS Access* , but when it comes time to upsize, they may have to be tossed...

JeffCoachman