Auto Populate a form field

A

A Bit Frustrated

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.
 
D

Dennis

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...
 
J

John W. Vinson

On Thu, 25 Mar 2010 12:36:01 -0700, A Bit Frustrated <A Bit
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top