Prev: HELP: Display search results in footer section in a split form
Next: Application.HyperLink vs controlname.HyperlinkAddress
From: A Bit Frustrated A Bit on 25 Mar 2010 15:36 I have two tables with 1:1 relationship. Both have same key field (SS Number). There are two forms, one for each table. When I open Form A there is a button to open Form B. When Form B opens, I want SS Number field to equal the SS Number on the current record in Form A. How do I do this? Thank you in advance.
From: Dennis on 25 Mar 2010 16:11 Well, IMO the easiest way would be to make Form B a subform of A, and linking via the common key. Or you could make Form A a tabbed form, and A would be the first tab and B would be the second. Just a couple of random thoughts... "A Bit Frustrated" wrote: > I have two tables with 1:1 relationship. Both have same key field (SS Number). > There are two forms, one for each table. > > When I open Form A there is a button to open Form B. When Form B opens, I > want SS Number field to equal the SS Number on the current record in Form A. > > How do I do this? > > Thank you in advance.
From: John W. Vinson on 25 Mar 2010 16:14
On Thu, 25 Mar 2010 12:36:01 -0700, A Bit Frustrated <A Bit Frustrated(a)discussions.microsoft.com> wrote: >I have two tables with 1:1 relationship. Both have same key field (SS Number). >There are two forms, one for each table. Why? One to one relationships are *very rare*; are you intentionally using Subclassing, or Table-based Record Security, or one of the other uncommon uses for the technique? Could you not just include the second table's fields in the first? >When I open Form A there is a button to open Form B. When Form B opens, I >want SS Number field to equal the SS Number on the current record in Form A. > >How do I do this? By far the simplest way is to make form B a Subform of form A, and use the SS Number as the Master/Child Link Field. You can also use VBA code in the OpenForm Method to a) set the WhereCondition to limit the second form to the corresponding record and b) use the OpenArgs property to pass the SS Number, and then use the second form's Open event to retrieve that value and use it as the default value of the second form. -- John W. Vinson [MVP] |