WUGNET, the Windows User Group Network
Your Complete Resource Center for "The Best" in Shareware, Computing Tips and Support, Windows Industry News... and much more!
Home Forums Shareware Windows Tips Hot Offers FREE Newsletters Arcade Contact Us About Partners
Search WUGNET: RSS Feeds RSS Feeds Advertise with WUGNET    |    Shareware eBooks
HomeHome FAQFAQ      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

Linking Two Tables

 
   Home -> Office other -> Table Design RSS
Next:  how to make name table and purchase table join an..  
Author Message
Gabe

External


Since: Aug 08, 2007
Posts: 13



(Msg. 1) Posted: Wed Oct 28, 2009 4:35 pm
Post subject: Linking Two Tables
Archived from groups: microsoft>public>access>tablesdbdesign (more info?)

I have two tables in Access 2003, Master (Parent) and Hours (Child).
Currently they share a One-To-One relationship. I need a record to be created
in the Hours table every time there is a record created in the Master Table,
but when users don't enter a vaule in the Hours table, it won't generate a
record?

When I run a query that includes fields from both tables, it only accounts
for the records in the Hours table. For example, if I have 886 records in the
Master Table, and 86 of those records were not filled out in the Hours table,
well then I only get 800 records back in my query. So if I want to know how
many people have entered thier hours, sure 800 is correct, but I want to know
out of 886 only 800 have entered their hours.

I fear that I should not have created two seperate tables, and that the
Hours table and the Master table should be one big table.
Back to top
Login to vote
John W. Vinson

External


Since: Jan 29, 2004
Posts: 4627



(Msg. 2) Posted: Wed Oct 28, 2009 6:01 pm
Post subject: Re: Linking Two Tables [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Wed, 28 Oct 2009 16:35:01 -0700, Gabe <Gabe.DeleteThis@discussions.microsoft.com>
wrote:

>I have two tables in Access 2003, Master (Parent) and Hours (Child).
>Currently they share a One-To-One relationship. I need a record to be created
>in the Hours table every time there is a record created in the Master Table,
>but when users don't enter a vaule in the Hours table, it won't generate a
>record?

One to one relationships are VERY RARE. Why do you feel that you need one?
What is in [Hours]? Does each Master record have one, and only one, forever,
value of this field?

>When I run a query that includes fields from both tables, it only accounts
>for the records in the Hours table. For example, if I have 886 records in the
>Master Table, and 86 of those records were not filled out in the Hours table,
>well then I only get 800 records back in my query. So if I want to know how
>many people have entered thier hours, sure 800 is correct, but I want to know
>out of 886 only 800 have entered their hours.
>
>I fear that I should not have created two seperate tables, and that the
>Hours table and the Master table should be one big table.

If each Master has only one Hours, then you're correct; but you can just add
an Hours field (or fields) to the Master table, join the two tables, and run
an Update query. The field will be NULL if there is no corresponding record in
Hours.

That said... you certainly do NOT need to create a dummy "placeholder" record
in Hours. instead, change the Join type in your query. Click on the join line
in query design view and select Option 2: "Show all records in Master and
matching records in Hours".

My guess is that you in fact should have a one to MANY (not one to one)
relationship; if this is a payroll or similar app, each employee will have
many work-periods with hours in each of them.
--

John W. Vinson [MVP]
Back to top
Login to vote
Gabe

External


Since: Aug 08, 2007
Posts: 13



(Msg. 3) Posted: Thu Oct 29, 2009 11:21 am
Post subject: Re: Linking Two Tables [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Thanks John, you are correct, I joined the two tables and the process wasn't
as bad as I thought it would be.

~Gabe

"John W. Vinson" wrote:

> On Wed, 28 Oct 2009 16:35:01 -0700, Gabe <Gabe.RemoveThis@discussions.microsoft.com>
> wrote:
>
> >I have two tables in Access 2003, Master (Parent) and Hours (Child).
> >Currently they share a One-To-One relationship. I need a record to be created
> >in the Hours table every time there is a record created in the Master Table,
> >but when users don't enter a vaule in the Hours table, it won't generate a
> >record?
>
> One to one relationships are VERY RARE. Why do you feel that you need one?
> What is in [Hours]? Does each Master record have one, and only one, forever,
> value of this field?
>
> >When I run a query that includes fields from both tables, it only accounts
> >for the records in the Hours table. For example, if I have 886 records in the
> >Master Table, and 86 of those records were not filled out in the Hours table,
> >well then I only get 800 records back in my query. So if I want to know how
> >many people have entered thier hours, sure 800 is correct, but I want to know
> >out of 886 only 800 have entered their hours.
> >
> >I fear that I should not have created two seperate tables, and that the
> >Hours table and the Master table should be one big table.
>
> If each Master has only one Hours, then you're correct; but you can just add
> an Hours field (or fields) to the Master table, join the two tables, and run
> an Update query. The field will be NULL if there is no corresponding record in
> Hours.
>
> That said... you certainly do NOT need to create a dummy "placeholder" record
> in Hours. instead, change the Join type in your query. Click on the join line
> in query design view and select Option 2: "Show all records in Master and
> matching records in Hours".
>
> My guess is that you in fact should have a one to MANY (not one to one)
> relationship; if this is a payroll or similar app, each employee will have
> many work-periods with hours in each of them.
> --
>
> John W. Vinson [MVP]
> .
>
Back to top
Login to vote
Display posts from previous:   
       Home -> Office other -> Table Design All times are: Eastern Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Categories:
 Windows XP
 Windows Vista
 Windows Other
 Office
  Office Other
 Security
  • Home |
  • Shareware |
  • Windows Tips |
  • Hot Offers |
  • FREE Newsletters |
  • Arcade |
  • Forums |
  • eBooks |
  • About WUGNET |
  • Partners |
  • Contact

  • WUGNET Privacy Policy |
  • Link to WUGNET |
  • IT Support