Solved

Access Dynamic List

Posted on 2012-04-03
7
267 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
Comment Utility
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
Comment Utility
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
Comment Utility
What about my other questions?

Can one task have many Projects?
Can one Project have many tasks?
0
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
LVL 74

Accepted Solution

by:
Jeffrey Coachman earned 500 total points
Comment Utility
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
Comment Utility
Hi Jeff,

Thank you for the information!

John
0
 
LVL 9

Expert Comment

by:macarrillo1
Comment Utility
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
Comment Utility
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

Complete Microsoft Windows PC® & Mac Backup

Backup and recovery solutions to protect all your PCs & Mac– on-premises or in remote locations. Acronis backs up entire PC or Mac with patented reliable disk imaging technology and you will be able to restore workstations to a new, dissimilar hardware in minutes.

Join & Write a Comment

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

743 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now