On Nov 26, 7:18 pm, John W. Vinson
<jvinson@STOP_SPAM.WysardOfInfo.com> wrote:
On Nov 27, 10:04 am, megbowlstr...@sbcglobal.net wrote:
> On Nov 26, 7:18 pm, John W. Vinson
>
[quoted text clipped - 54 lines]
>
> - Show quoted text -
I got the error to quit appearing by erasing the default value of 0
but the relationship still doesn't appear to be working. Thanks for
your response--further help would be appreciated. :)
John W. Vinson - 27 Nov 2007 19:43 GMT
>I got the error to quit appearing by erasing the default value of 0
>but the relationship still doesn't appear to be working. Thanks for
>your response--further help would be appreciated. :)
Again: you need to - somehow, I don't know how because I don't know your data
- get the PlanID inserted into the existing records in your distributions
table. What you have now is the employeeID in both the Plans and Distributions
table. I'm assuming that it should NOT exist in the distributions table; you
only need the PlanID.
What you might be able to do - back up your database first!! - is update the
(now empty) PlanID field to the PlanID field from Plans, linking by
employeeID. This will fail if an employee has multiple plans... but without
knowing which distribution corresponds to which plan, there's no way Access
(or any program!!) can update the PlanID appropriately. You may have to go
back to paper to figure out which distribution goes with which plan.
John W. Vinson [MVP]
>I'm actually having trouble relating the two tables. Here is my field
>list:
[quoted text clipped - 11 lines]
>Distribution ID (primary key; autonumber)
>Employee ID (foreign key that links to tbl_Employee)
That's your problem. A distribution is only *indirectly* related to an
employee! It's a distribution *from a plan*, and you should have Employees
related one to many to plans (as you do, above); and Plans related one to many
to Distributions.
One question though - should there not be a many to many relationship from
employees to plans? Surely each Plan involves many employees, right? Wouldn't
there need to be a table of plan names, terms, description, etc...? As it is
you'll be repeating the plan name in tbl_Plan for every employee in that plan.
>Distribution Taken
>Payment Type
[quoted text clipped - 10 lines]
>me an error that says "You cannot add or change a record because a
>related record is required in table tbl_Plan."
That's because the new PlanID field (don't use blanks in fieldnames!!!) is
either NULL or defaulting to zero. You can't just put in the field and expect
Access to automagically figure out which PlanID ought to be put into it!!
>I didn't see the master and child link fields on the subform's
>properties. Really I think that if I can get the relationship working
>then everything else will fall into place.
These are properties *of the subform control*, the empty box containing the
form - not properties of the form object within that control. Select the edge
of the subform, or use the dropdown list of controls on the left end of the
toolbar.
John W. Vinson [MVP]
megbowlstrike@sbcglobal.net - 27 Nov 2007 19:40 GMT
On Nov 27, 11:31 am, John W. Vinson
<jvinson@STOP_SPAM.WysardOfInfo.com> wrote:
> >I'm actually having trouble relating the two tables. Here is my field
> >list:
[quoted text clipped - 53 lines]
>
> - Show quoted text -
Thanks so much for your help John! I managed to get the subform
working by deleting the relationship between tbl_Plan and
tbl_Employee. Then I changed the master/child links to PlanID (thanks
for your tip on the field names). I haven't used Access in a long
time but studied it in school, so it's starting to come back to me a
little bit.
I didn't do a separate table for Plan names because it is likely that
they will all be different--there are no set names. The database
houses international employees and it seems that every employee is in
a differently-named plan. I was going to have a set list of plan
names for the user to choose one from a drop down list but after
talking to the user and looking at the data, it seems like a better
idea to let him/her type in the plan name.
Thanks again for your help! :)