Link to home
Create AccountLog in
Microsoft Access

Microsoft Access

--

Questions

--

Followers

Top Experts

Avatar of dkilby
dkilby🇨🇦

MS Access 2010 + lookup field dependent on value from other field
i am new to ms access, and trying to setup a main table, it has on field that is is a lookup field from another table, a list of categories, for each category there is a list of questions, i want to add another lookup field that pulls the list of questions for the category selected in the category field - is this possible and if so how?

Zero AI Policy

We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.


Avatar of Missus Miss_SellaneusMissus Miss_Sellaneus🇺🇸

Something like this:

Table: categories
CatID
Category

Table: questions
QuestionID
CatID
Question

Then, for example, to select questions using the lookup:

SELECT mytable.*, categories.category, questions.question FROM mytable, categories, questions WHERE mytable.catID = categories.catID AND categories.catID = questions.catID

Avatar of dkilbydkilby🇨🇦

ASKER

so do i create the query then when i add a lookup field, select the query to populate the field?

Avatar of Missus Miss_SellaneusMissus Miss_Sellaneus🇺🇸

Sorry, I don't understand your last question. You'll need to create 2 lookup tables.  For each new category, you'll add 1 record (row) to the category table, and add 1 or more question records to the question table, each of the new records in the question table will have the same CATID as the new record in the category table.

Your non-lookup table will contain CATID, which you can use to lookup the list of questions by joining to the 2 lookup tables as in my example (or just join to the question table if you don't want the category name).

Were you looking for an update query?

Reward 1Reward 2Reward 3Reward 4Reward 5Reward 6

EARN REWARDS FOR ASKING, ANSWERING, AND MORE.

Earn free swag for participating on the platform.


Avatar of Missus Miss_SellaneusMissus Miss_Sellaneus🇺🇸

What do you want your results to look like?

Avatar of dkilbydkilby🇨🇦

ASKER

i want to create a new table lets call it Student, i want to add a field that is populated from the category table, i am using a Lookup & Relationship field type and populating with the category table.

I want to add another field for questions, but i want to populate it pulling questions from the question table where category matches the selection from the category dropdown.

I have the category and question table setup like you have above.  

When i select lookup & relationship i can select a table or query to populate, so i am guessing i need to create a query first then select it.

Avatar of Missus Miss_SellaneusMissus Miss_Sellaneus🇺🇸

So, you have an interactive form of some sort, and the user selects a category and you want to display the questions for the category?  You would need to create a query that selects all questions where catID is equal to the studen't catID.

And if each student can have multiple questions, you would create another lookup table.. "StudentQuestions" which has only 2 fields, studentID and questionID.


Free T-shirt

Get a FREE t-shirt when you ask your first question.

We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.


Avatar of Missus Miss_SellaneusMissus Miss_Sellaneus🇺🇸

So, they'd select a category, it runs a query grabbing all questions for the category, displays the list, the user selects 1 or more questions.One record is added to the StudentQuestions table per user selected question.

Avatar of dkilbydkilby🇨🇦

ASKER

they only select one question, but yes they select a category, runs query and grabs all questions for that category, user selects one of the questions

Avatar of Missus Miss_SellaneusMissus Miss_Sellaneus🇺🇸

The user selects a category.
Run query and display all questions for the category to the user.
User selects a question.
The selected QuestionID is stored in the student table.

Reward 1Reward 2Reward 3Reward 4Reward 5Reward 6

EARN REWARDS FOR ASKING, ANSWERING, AND MORE.

Earn free swag for participating on the platform.


Avatar of dkilbydkilby🇨🇦

ASKER

i have attached a basic version of what i mean, if you open the student info table i want to add a field that populates questions depending on what was selected in the category field

so i enter student name, select a category, then the next field would let me select a question linked the categories just selected. Database1.accdb

ASKER CERTIFIED SOLUTION
Avatar of Missus Miss_SellaneusMissus Miss_Sellaneus🇺🇸

Link to home
membership
Log in or create a free account to see answer.
Signing up is free and takes 30 seconds. No credit card required.
Create Account
Microsoft Access

Microsoft Access

--

Questions

--

Followers

Top Experts

Microsoft Access is a rapid application development (RAD) relational database tool. Access can be used for both desktop and web-based applications, and uses VBA (Visual Basic for Applications) as its coding language.