By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,106 Members | 2,686 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,106 IT Pros & Developers. It's quick & easy.

trying to use dual relationships and getting dupes

P: n/a
I have a form/table with an autoid it is linked to a table/form with
and ID as a 1 to many.
Under this form/table I need another table with many records for each
on of the many in the previous table.
form1 form2 form3
table1 table2 table3

autoid -1-------------@ ID -1-----------------@- ID2

of course it won't allow this so I put in a second ID

autoid1 -1-------------@ ID1
ID2 -1-----------------@- ID3

so ID2 is not an autoid based on a record in table 2

but when a sub sub form is built using table3
when a record is created in form2 instead of id2 generating a single
new number to be used in form3 I get 4 blank records.

there is some code under form current and even when its removed I
generate 4 ID2 records that have NO ID1 values

so instead of 1--------1
2

I am getting null 1
null 2
null 3
null 4

I can't think of why I would get 4 records generated in this way since
At first I thought that the sub sub form was generating the records
but I am getting nothing in table1 or table3.
just blank records being generated by the ID2 which is an autonumber.
autonumber-----this got me thinking but what is firing it 4 times ?

I could see 1 since its linked but why 4?



Apr 10 '07 #1
Share this Question
Share on Google+
1 Reply


P: n/a
the primary key in Table1 should be linked to a corresponding *foreign key*
in Table2.
the primary key in Table2 should be linked to a corresponding *foreign key*
in Table3.

once you've set those relationships up correctly in the Relationships
window, and enforced referential integrity on each one, then you can create
a mainform/subform/subform setup that *doesn't need any code at all* to
relate child records to parent record; Access will do it automatically.

bind the mainform to Table1.
bind subform1 to Table2.
in mainform Design view, add a subform control to "hold" subform1. set the
subform control's LinkMasterFields property to the name of the primary key
in Table1; set the LinkChildFields property to the name of the corresponding
*foreign* key in Table2.
bind subform2 to Table3.
in subform1 Design view, add a subform control to "hold" subform2. set the
subform control's LinkMasterFields property to the name of the primary key
in Table2; set the LinkChildFields property to the name of the corresponding
*foreign* key in Table3.

hth
"sparks" <js******@swbell.netwrote in message
news:2p********************************@4ax.com...
I have a form/table with an autoid it is linked to a table/form with
and ID as a 1 to many.
Under this form/table I need another table with many records for each
on of the many in the previous table.
form1 form2 form3
table1 table2 table3

autoid -1-------------@ ID -1-----------------@- ID2

of course it won't allow this so I put in a second ID

autoid1 -1-------------@ ID1
ID2 -1-----------------@- ID3

so ID2 is not an autoid based on a record in table 2

but when a sub sub form is built using table3
when a record is created in form2 instead of id2 generating a single
new number to be used in form3 I get 4 blank records.

there is some code under form current and even when its removed I
generate 4 ID2 records that have NO ID1 values

so instead of 1--------1
2

I am getting null 1
null 2
null 3
null 4

I can't think of why I would get 4 records generated in this way since
At first I thought that the sub sub form was generating the records
but I am getting nothing in table1 or table3.
just blank records being generated by the ID2 which is an autonumber.
autonumber-----this got me thinking but what is firing it 4 times ?

I could see 1 since its linked but why 4?



Apr 10 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.