Form needs to update two tables then ...


J

JR

This is posted to Forms Design also.

I have one form and two tables that I am working with.

tbl_Tasks: with an auto number key and a list of tasks

and Hours: with its own auto number key and a list of tasks that each
employee works on. The tasks that the employee works on is selected (on a
form) from tbl_Tasks -- OR -- gets added to the table by using a combo box in
a form, frm_hrs.

I need to find a way to get the form (frm_hrs) to update tbl_tasks with any
new tasks added in the combo box. I can not figure out how to make this
happen.

There does not seem to be a problem updating tbl_hrs with the information
EXCEPT that the task number (ID) for a newly entered task doesn't update
(because tbl_tasks hasn't generated a new auto-number for the new task which
hasn't been added to it).

Could use some help to make this happen.

Thanks!
 
Ad

Advertisements

J

Jeff Boyce

You've described the form, but I'm having trouble understanding the
relationship between the tables (or visualizing what fields are in which
table(s)).

More info, please...

Regards

Jeff Boyce
Microsoft Access MVP

--
Disclaimer: This author may have received products and services mentioned
in this post. Mention and/or description of a product or service herein
does not constitute endorsement thereof.

Any code or psuedocode included in this post is offered "as is", with no
guarantee as to suitability.

You can thank the FTC of the USA for making this disclaimer
possible/necessary.
 
J

JR

Hope this helps clarrify:

tasks table: "KEY" (auto number) | Tasks (text)

hours table: KEY | task (to be populated from the task table) | date |
hours |
 
J

Jeff Boyce

I still don't see how these two tables "share" a common field, necessary for
them to be "related".

More info, please...

Regards

Jeff Boyce
Microsoft Access MVP

--
Disclaimer: This author may have received products and services mentioned
in this post. Mention and/or description of a product or service herein
does not constitute endorsement thereof.

Any code or psuedocode included in this post is offered "as is", with no
guarantee as to suitability.

You can thank the FTC of the USA for making this disclaimer
possible/necessary.
 
J

John W. Vinson

Hope this helps clarrify:

tasks table: "KEY" (auto number) | Tasks (text)

hours table: KEY | task (to be populated from the task table) | date |
hours |

It appears that you're trying to store *BOTH* the Key and the Task from the
Tasks table into the Hours table.

That's not how relational databases work! They use the "Grandmother's Pantry
Principle": "A place - ONE place! - for everything, everything in its place".
The text name of the task should exist in the Tasks table, and *only* there.

Rather than storing it redundantly in the Hours table, you would store just
the Long Integer KEY value as a link to the autonumber KEY of the tasks table;
you would then use a Query, or a Combo Box, or the like to *show* the text of
the task in conjunction with other data from the Hours table.
 
Ad

Advertisements

S

Stuart McCall

"Grandmother's Pantry Principle" LOL - hadn't run across that one before.

IMO it ought to be said that this principle should also apply to code (in
any language).
 
Ad

Advertisements


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