|
 |
access thread: Pass Primary Key of Parent Table to Secondary Key of Child
Message #1 by ebushido@h... on Wed, 30 Oct 2002 01:02:32
|
|
Hi guys...
I am using a form to input records to a table. I want to assign a button
to open a table that has a many relationship to the primary table. I want
the new form that opens to inherit the primary key of the parent table
into the Secondary Key of the many side of the relationship in the child
table. This must be enforced to be the same as long as it is displayed in
the Parent Table. I have locked down the functions to only allow them to
add one record at a time.
What would be a good class or sub to write to handle this, as this needs
to be done with nearly 25 forms off of other main forms. For more
information look at this example
Name 1--------oo Alias
(One) (Many)
Person 1-------oo Pictures
(One) (Many)
Any Help would be greatly appreciated.
Todd Damon
Message #2 by "Haslett, Andrew" <andrew.haslett@i...> on Wed, 30 Oct 2002 14:52:15 +1030
|
|
Are sub-forms a possibilty for your situation? As they do this
automatically.
Cheers,
Andrew
-----Original Message-----
From: ebushido@h... [mailto:ebushido@h...]
Sent: Wednesday, 30 October 2002 11:33 AM
To: Access
Subject: [access] Pass Primary Key of Parent Table to Secondary Key of
Child
Hi guys...
I am using a form to input records to a table. I want to assign a button
to open a table that has a many relationship to the primary table. I want
the new form that opens to inherit the primary key of the parent table
into the Secondary Key of the many side of the relationship in the child
table. This must be enforced to be the same as long as it is displayed in
the Parent Table. I have locked down the functions to only allow them to
add one record at a time.
What would be a good class or sub to write to handle this, as this needs
to be done with nearly 25 forms off of other main forms. For more
information look at this example
Name 1--------oo Alias
(One) (Many)
Person 1-------oo Pictures
(One) (Many)
Any Help would be greatly appreciated.
Todd Damon
IMPORTANT - PLEASE READ ********************
This email and any files transmitted with it are confidential and may
contain information protected by law from disclosure.
If you have received this message in error, please notify the sender
immediately and delete this email from your system.
No warranty is given that this email or files, if attached to this
email, are free from computer viruses or other defects. They
are provided on the basis the user assumes all responsibility for
loss, damage or consequence resulting directly or indirectly from
their use, whether caused by the negligence of the sender or not.
Message #3 by ebushido@h... on Wed, 30 Oct 2002 13:51:46
|
|
Actually having a form that has 25 subforms in it would be terribly
cumbersome, especially when some of the subforms won't contain records on
the subject.
I will give a better description of it in a succeeding thread.... It will
have the same subject name.
Todd
> Are sub-forms a possibilty for your situation? As they do this
automatically.
Cheers,
Andrew
-----Original Message-----
From: ebushido@h... [mailto:ebushido@h...]
Sent: Wednesday, 30 October 2002 11:33 AM
To: Access
Subject: [access] Pass Primary Key of Parent Table to Secondary Key of
Child
Hi guys...
I am using a form to input records to a table. I want to assign a button
to open a table that has a many relationship to the primary table. I want
the new form that opens to inherit the primary key of the parent table
into the Secondary Key of the many side of the relationship in the child
table. This must be enforced to be the same as long as it is displayed in
the Parent Table. I have locked down the functions to only allow them to
add one record at a time.
What would be a good class or sub to write to handle this, as this needs
to be done with nearly 25 forms off of other main forms. For more
information look at this example
Name 1--------oo Alias
(One) (Many)
Person 1-------oo Pictures
(One) (Many)
Any Help would be greatly appreciated.
Todd Damon
IMPORTANT - PLEASE READ ********************
This email and any files transmitted with it are confidential and may
contain information protected by law from disclosure.
If you have received this message in error, please notify the sender
immediately and delete this email from your system.
No warranty is given that this email or files, if attached to this
email, are free from computer viruses or other defects. They
are provided on the basis the user assumes all responsibility for
loss, damage or consequence resulting directly or indirectly from
their use, whether caused by the negligence of the sender or not.
Message #4 by "Amy Wyatt" <amyw@c...> on Wed, 30 Oct 2002 17:07:09
|
|
Using the Docmd.OpenForm you can specify a filter on opening the form. For
instance, if you store the key in varKey and are opening form frmAlias
then you would use the following code:
varKey=frmParent!ID
Docmd.OpenForm "frmAlias", acNormal, , "AliasID=" & varKey
or if your Key is text
Docmd.OpenForm "frmAlias", acNormal, , "AliasID='" & varKey & "'"
Hope this helps,
Amy
> Hi guys...
>
I> am using a form to input records to a table. I want to assign a button
t> o open a table that has a many relationship to the primary table. I
want
t> he new form that opens to inherit the primary key of the parent table
i> nto the Secondary Key of the many side of the relationship in the child
t> able. This must be enforced to be the same as long as it is displayed
in
t> he Parent Table. I have locked down the functions to only allow them to
a> dd one record at a time.
> What would be a good class or sub to write to handle this, as this needs
t> o be done with nearly 25 forms off of other main forms. For more
i> nformation look at this example
> Name 1--------oo Alias
(> One) (Many)
> Person 1-------oo Pictures
(> One) (Many)
> Any Help would be greatly appreciated.
> Todd Damon
|
|
 |