Solved

Access Dynamic List

Posted on 2012-04-03
7
272 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
Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

 
LVL 74

Accepted Solution

by:
Jeffrey Coachman earned 500 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

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

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

AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

707 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