• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 466
  • Last Modified:

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?
image 1Lookup-Question.accdb
  • 5
  • 3
1 Solution
Jeffrey CoachmanMIS LiasonCommented:
Is your goal here simply to select a table from one combobox, and have a second combobox display the associated fields?
If so then see the attached sample.

As was stated by the first expert.
This is a *Nightmare* in tables.. , this is typically done in a form
See here for more info:

shambaladAuthor Commented:
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?
shambaladAuthor Commented:
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.
Get 10% Off Your First Squarespace Website

Ready to showcase your work, publish content or promote your business online? With Squarespace’s award-winning templates and 24/7 customer service, getting started is simple. Head to Squarespace.com and use offer code ‘EXPERTS’ to get 10% off your first purchase.

shambaladAuthor Commented:
I just posted this in the other question:
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.
Jeffrey CoachmanMIS LiasonCommented:
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
shambaladAuthor Commented:
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.
Jeffrey CoachmanMIS LiasonCommented:
<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

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

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Easily Design & Build Your Next Website

Squarespace’s all-in-one platform gives you everything you need to express yourself creatively online, whether it is with a domain, website, or online store. Get started with your free trial today, and when ready, take 10% off your first purchase with offer code 'EXPERTS'.

  • 5
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now