[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Access Dynamic List

Posted on 2012-04-03
7
Medium Priority
?
275 Views
Last Modified: 2012-04-04
Hello,

I am new to Microsoft Access 2007. I am creating a form and I want to use a list that is created from data in a table. Here is what I have.

2 Tables: Projects and Task.

The tables are related by the projects.

In the task table I want to select the project using a drop down list that is created by a query of the Projects table. Therefore the user can assign a task to an existing project.

Thanks,

John
0
Comment
Question by:jpldpd
  • 4
  • 2
7 Comments
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 37804419
1.
<The tables are related by the projects.>
So what is the parent table and what is the child?
The relationship you state would imply the the parent is ProjectID
But this:
"n the task table I want to select the project using a drop down"
..implies that the Task is the parent.

Can one task have many Projects?
Can one Project have many tasks?
Please clarify the relationship between Tasks and Projects


2. So what is your one distinct question?
How to create a combobox to select a Project?
Or
How to create a combobox to select a Task?
or Both?
or neither?

In other words, please describe in detail what you ultimate goal here is...

JeffCoachman
0
 

Author Comment

by:jpldpd
ID: 37805547
Hello.

The project table is the parent. The project can have many task. Since the project will be created first, and must be unique, I want the user to select an existing project for each task. Therefore I want a list option for the project field within the task form.

HTH,

John
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 37806305
What about my other questions?

Can one task have many Projects?
Can one Project have many tasks?
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 74

Accepted Solution

by:
Jeffrey Coachman earned 2000 total points
ID: 37806379
In a basic system Parent=Project, Child=Task (On-To-Many)
The form for creating tasks would be similar to the attached sample.

(Note that having a combobox on the Task form will tempt users to accidentally "change" the project.
You will have to deal with this scenario in another discussion)

JeffCoachman
Database73.mdb
0
 

Author Comment

by:jpldpd
ID: 37806526
Hi Jeff,

Thank you for the information!

John
0
 
LVL 9

Expert Comment

by:macarrillo1
ID: 37806642
If your goal is to produce a dropdown list of your projects within a Task Form:

1. Create a query that is a list of your projects
     
    Go to Create tab and click Query Wizard
    Select Simple Query Wizard and click OK
    Select Project table from dropdown list.
    Select 'Project Name' Field and click the '>' icon.
    Click next and give your query a name (like LU_ProjectName)
    Click finish.
   
2. Modify your Task Table to use the Project list query

    Select your 'Task' table from the left panel.
    Right Click on your table and select Table design.
    Select the field that you want the Task table to use (ie Projects).
    On the bottom half of the display are the properties of the field.
    Click the 'Lookup' tab.
    Click in the field that has 'Text Box' and select 'Combo Box'
    Click in the Row Source field and select your query (LU_ProjectName)
    Save the changes to your table.

3.  Modify your form to use the dropdown field and the lookup query

    In your Task form, right click the Project field and click 'Change to'
    Select 'Combo box'
    Right click and select properties.
    In the Properties click the Data tab.
    Click the Row Source and select your query (LU_ProjectName)
    Now view and test your field.

Within the properties you can further configure your dropdown list
(Width, number of entries to show, etc).


However, it sounds as if your table relationship is:

Project Table (Parent Table)
Task Table(Child Table)

Which would be a one to many.  In which case you could create a Project Form with
a Task Subform.  Something like the following:

---------
|Parent Form(Project)
|
|PField1
|PField2
|PField...
|
|     -------
|    | Child Form/Sub Form(Task)
|    |
|    | CField1, CField2, CField...<=Task 1
|    | CField1, CField2, CField...<=Task 2
|    | CField1, CField2, CField...<=Task ...    
|    |
|     -------
|
---------
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 37806810
macarrillo1,
<Click the 'Lookup' tab.>
...Most Access developers and Experts here will frown on this.
There are countless questions here were users have twisted themselves in knots over this "feature"
;-)
It has many drawbacks... among them, ...see here:
http://access.mvps.org/access/lookupfields.htm
...I also state that these fields will not easily translate when the DB is upgraded to SQL...

So it is often suggested that the lookups be put in the form (not the table)

;-)

JeffCoachman
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
Explore the ways to Unlock VBA Project Password Excel 2010 & 2013 documents. Go through the article and perform the steps carefully to remove VBA Excel .xls file.
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses
Course of the Month20 days, 10 hours left to enroll

868 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question