UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

> A subform within a subform...within a form    
 
   
Frisco
post Jul 11 2005, 03:31 PM
Post #1

UtterAccess Enthusiast
Posts: 50



Hi,

I am working on an employee booking database and am having an issue with one particular component. I am setting up an add customer form (see the enclosed JPG file). As you will see, the customer form has within it a sites subform (each customer could have multiple site addresses). You will also see that the sites subform has within it a contacts subform because each site can have multiple contacts.

Now, when I bring up the form, it is displaying the information as I have entered it through the datasheet view - that is fine. But when I try and enter in new contact information in the subform, it is not working.

My data structure is that the customers table is linked to the sites table through "site ID"; the sites table is linked to a sitecontacts table through "site ID"; and the sitecontact table is linked to the contacts table through "contact ID". I wasn't having any luck in linking the sites table and the contacts table directly to ensure I could get multiple contacts for a site (unless I was doing something wrong).

Now it seems that the problem is in this sitecontact table (which consists of 3 fields, sitecontactID, siteID and contactID. sitecontactID is an autonumber field as is the contactID in the contacts table. My form is trying provide an autonumber for both. But it would seem a must to do so as both must be updated - the sitecontact table provides the relationship between the site and the contact while the contacts table provides the contacts info.

Any suggestions?

Thanks,
Brad.
Attached File(s)
Attached File  Customersform.jpg ( 170.89K ) Number of downloads: 5
 
Go to the top of the page
 
+
 
Start new topic
Replies (1 - 3)
Jack Cowley
post Jul 11 2005, 03:47 PM
Post #2

Retired Moderator
Posts: 37,716
From: The San Francisco Bay Area



tblCustomers
CustomerID (PK and auto)
LastName
FirstName

tblSites
SiteID (PK and auto)
CustomerID (FK)
...other necessary fields...

tblContacts
ContactsID (PK and auto)
SiteID (FK)
...other necessary fields...

If your tables are set up as above the form/subform/subsubform should work... if the Sites form is in datasheet view you will need to put code in the On Current event to put the SiteID into a hidden control and link the subsubforms Master Link to that hidden control.

hth,
Jack
Go to the top of the page
 
+
Frisco
post Jul 11 2005, 04:16 PM
Post #3

UtterAccess Enthusiast
Posts: 50



That works PERFECTLY!!! - Thanks Jack - I really appreciate your help.
Go to the top of the page
 
+
Jack Cowley
post Jul 11 2005, 04:29 PM
Post #4

Retired Moderator
Posts: 37,716
From: The San Francisco Bay Area



Phew! Glad to hear that was the solution you were looking for... Continued success with the project....

Jack
Go to the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 18th June 2013 - 11:09 PM