Multiple subforms

  • Thread starter Thread starter Rick
  • Start date Start date
R

Rick

I have a many to many relationship between tblContacts and
tbllAddresses through tblRelationships as follows:

tblContacts
lngContactID PK (autonumber)
txtContactName

tblRelationships
lngRelationID PK (autonumber)
lngContactID
lngAddressID
lngCompanyID
lngBankID

tblAddresses
lngAddressID PK (autonumber)
txtAddress1
txtAddress2

I would like to place two subforms (side by side) on the
main form (frmContacts) to permit the user to enter more
than one address for each user. The user wishes to see
both the last address entered and the new address being
entered at the same time to compare the details of the
addresses.

How do I place two subforms on the Contacts main form to
allow the user to enter two distinct address records at
the same time.

I have attempted creating another form named frmAddressOne
based on tblRelationship with a subform frmDetAddrOne on
it based on tblAddresses.

frmAddresses is linked to frmRelationships using
lngRelationID and tblRelationships is linked to the main
form frmContacts using lngContactID.

I then created another form named frmAddressTwo based on
tblRelationship with a subform frmDetAddrTwo on it based
on tblAddresses.

frmAddresses is linked to frmRelationships using
lngRelationID and tblRelationships is linked to the main
form frmContacts using lngContactID.

I have activated record navigation on the main form
frmContacts and on the two subforms frmAddressOne and
frmAddressTwo. Record selection is inactive for both
subforms frmDetAddrOne and frmDetAddrTwo.

When moving from subform frmAddressOne (on the left) to
frmAddressTwo (on the right) I expected Access to write
the first record into tblRelationship and tblAddresses
permitting a new record to be entered into these same two
tables via the frmAddressTwo.

However, both forms continue to point to the same record.
Any entry in the right from changes the corresponding
field in the left form.

How do I get subform frmAddressOne to update the tables
and continue to display the first address details when the
user moves to the second subform to enter the second
address?
 
Rick,

You only need one subform to enter multiple addresses. Set
your subform up to be Continuous Forms and make the subform
control on the main form big enough to see multiple records
and it should display the addresses that have been entered
although you may have to scroll a bit depending on how many
you have and the size of the control. The method you setup
just gives two views of the same record.

--

Gary Miller
Gary Miller Computer Services
Sisters, OR
________________________
 
Gary:

Thanks for the suggestion. However, you can't show a form
in continuous format when it itself has a subform on it.

frmContact (main form based on tblContact)
frmAddressOne (subform based on tblRelationships)
frmDetAddrOne (subform based on tblAddresses)

I have to use three tables. The intermediate table
tblRelationships provides the juntion for many to many
relationships.

For example, an Address may be that of several Contacts
(individuals)in tblContacts and/or that of several
Companies in tblCompanies.

Rick
 
I must have misunderstood you. I thought that you had 2
Address subforms from your first post. I was just trying to
get you down to one continuous Address subform.

--

Gary Miller
Gary Miller Computer Services
Sisters, OR
________________________
 
Back
Top