Solved

Access Dynamic List

Posted on 2012-04-03
7
269 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
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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

Suggested Solutions

In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

805 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