?
Solved

Access Dynamic List

Posted on 2012-04-03
7
Medium Priority
?
273 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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

Industry Leaders: 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!

Question has a verified solution.

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

Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses

777 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