Changes in Form (based on query) are reflected to the wrong table

A

Aldo

Hi guys,

I am new to MS Access. I am working with Access 2007.
I have some problems while creating a form.

I have created the following tables:

Table "People":
PeopleID FirstName
2 Aldo

Table "Tasks":
TaskID TaskDescription
2 A
3 B
4 C

Table "PeopleTasks":
PeopleTasksID PeopleID TasksID
2 2 3

I have a query named "Get_PeopleTasks" as follows:
SELECT
People.FirstName,
Tasks.TaskDescription
FROM
(People
INNER JOIN PeopleTasks ON People.PeopleID=PeopleTasks.PeopleID)
INNER JOIN Tasks ON PeopleTasks.TaksID=Tasks.TaksID;

Running the query I get the data below:
FirstName TaskDescription
Aldo B

I need to create a form to quickly updating data in those tables, in
example, changing "B" to "C" will also change the value of field " TasksID"
from "3" to "4".
I created a new form based on query "Get_PeopleTasks", changed
TaskDescription as combo box and programmatically set it to show the values
in table "Tasks.TaskDescription" on form load.
When trying to change the value in the combo box (clicking on another
option), I get the change reflected in table "Tasks", so the values in the
table will look that:
TaskID TaskDescription
2 A
3 C
4 C

How can I work it around?
What I am doing wrong?

Thanks in advance for any help,
Aldo.
 
J

June7 via AccessMonster.com

Your query needs the field TasksID from the PeopleTasks table and the combo
box should be bound to this field. Right now it appears to be bound to the
TaskDescription field of Tasks table so you are changing the description in
that table but not changing the task ID that the record in PeopleTasks is
linked to. The RowSource in the combobox should include the TaskID and
TaskDescription (in that order) from Tasks table but the ControlSource should
be TasksID of PeopleTasks table. Users should see the task description but
not the ID in order to make informed choice. Set the ColumnCount to 2,
ColumnWidths to 0;2.
You can build the query in the form's RecordSource property, doesn't have to
be a saved query.
 
A

Aldo

I'll try it.
Thanks a lot,
Aldo.


June7 via AccessMonster.com said:
Your query needs the field TasksID from the PeopleTasks table and the combo
box should be bound to this field. Right now it appears to be bound to the
TaskDescription field of Tasks table so you are changing the description in
that table but not changing the task ID that the record in PeopleTasks is
linked to. The RowSource in the combobox should include the TaskID and
TaskDescription (in that order) from Tasks table but the ControlSource should
be TasksID of PeopleTasks table. Users should see the task description but
not the ID in order to make informed choice. Set the ColumnCount to 2,
ColumnWidths to 0;2.
You can build the query in the form's RecordSource property, doesn't have to
be a saved query.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top