473,779 Members | 1,905 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

managing multiple related subforms and many to many relationships

59 New Member
Hello I'm new to developing databases in Access and using Access2003. I have a dataset with a few many to many relationships that I have created linking tables for to make multiple 1:M relationships.
My problem is trying to figure out a set of forms and subforms for this data in which the users can enter new data in a straightforward way. In my dataset there are: Buildings, Contacts, addresses for buildings and contacts, and different types of contacts. The contact types are super, manager, and volunteer.
Here are the relationships:
- A building has more than one contact and a contact can be associated with more than one building. (M:M)
- contact can be more than one type (1:M)
- an address can be associated with more than one contact (1:M).
- a building is associated with one address. (1:1)

Here is how I set up my tables:

tblBldg
BldgID PK
BldgName
(other unique bldg attributes)
AddrID FK

tblContacts
ContactID PK
ContactNmLast
ContactNmFirst
(other unique contact attributes)

tblContactTypes
TypeID PK
TypeNm

tbl Addresses
AddrID PK
StreetAddr
City
State
ZipCode

tblContactTypeU Q
ContactTypeID PK
ContactID
TypeID

tblContactTypeA ddr
ContactTypeID
AddrID

tblBldgContactT ype
BldgID
ContactTypeID

Specifically, I tried to set up a form starting with Buildings that had subforms in which you can view the building address and the multiple contacts associated with a building and their attributes (including their addresses - a nested subform under Contacts). When I add a new building name in the main form and then try to add an address for that building in the adress subform (to be entered in the address table) it will not let me b/c there is not already an ID for the Address that I want to add. Also, when I try to add a contact and its related data in the contact subform, the linking tables do not update (the tbl BldgContactType table or a record is not added to the tblContactTypeU Q table). Same for the table linking ContactTypeID and AddrID.
Please advise!
thanks in advance.
Bridget
Aug 17 '07
22 3230
FishVal
2,653 Recognized Expert Specialist
Hi FishVal.
Here is the OnClick code for the btnAddAddr in the main form:
Expand|Select|Wrap|Line Numbers
  1. Private Sub btnAddAddr_Click()
  2. On Error GoTo Err_btnAddAddr_Click
  3.  
  4.     Dim stDocName As String
  5.     Dim stLinkCriteria As String
  6.  
  7.     stDocName = "frmAddr1"
  8.     DoCmd.OpenForm stDocName, , , stLinkCriteria
  9.     DoCmd.GoToRecord , , acNewRec
  10. Exit_btnAddAddr_Click:
  11.     Exit Sub
  12.  
  13. Err_btnAddAddr_Click:
  14.     MsgBox Err.Description
  15.     Resume Exit_btnAddAddr_Click
  16.  
  17. End Sub
  18.  
This opens frmAddr1 in which I can add a new address.

Then there is a "Done" button in the frmAddr1
The code here for this button is:
Expand|Select|Wrap|Line Numbers
  1. Private Sub btnDone_Click()
  2. On Error GoTo Err_btnDone_Click
  3.  
  4.     DoCmd.Close
  5.  
  6. Exit_btnDone_Click:
  7.     Exit Sub
  8.  
  9. Err_btnDone_Click:
  10.     MsgBox Err.Description
  11.     Resume Exit_btnDone_Click
  12.  
  13. End Sub
  14.  
What happens after I click "Done" is that the frmAddr1 closes and you are back looking at the main form. However, the new address is not showing in the control and when i click on the control to select it, the form jumps back to the first record.

Bridget
Hi, Bridget.

Plz post where combobox [Addr1] is located. Include the names of all forms in form/subform nesting.
And BTW did you try the code for NotInList event I've posted in msg#18 ?
Aug 23 '07 #21
banderson
59 New Member
Hello FishVal,
Sorry for long-delayed response. I finally bought a VBA for beginners book and this is all starting to make more sense. And, yes, the code you gave me for the notinlist event worked! Thank you for having taken the time to respond to my questions!
Bridget

Hi, Bridget.

Plz post where combobox [Addr1] is located. Include the names of all forms in form/subform nesting.
And BTW did you try the code for NotInList event I've posted in msg#18 ?
Sep 6 '07 #22
FishVal
2,653 Recognized Expert Specialist
Hello FishVal,
Sorry for long-delayed response. I finally bought a VBA for beginners book and this is all starting to make more sense. And, yes, the code you gave me for the notinlist event worked! Thank you for having taken the time to respond to my questions!
Bridget
You are welcome.

Regards,

Fish
Sep 6 '07 #23

Sign in to post your reply or Sign up for a free account.

Similar topics

17
1856
by: Steve Jorgensen | last post by:
Terminology question: Is there a term for a set of records related directly or indirectly by key value in several tables? For example, a single invoice record and its line item records -or- a single customer, the customer's orders, the order lines for those orders, the customer's invoices, and the invoice lines for those invoices. I'm thinking the term might be graph, but I'm not at all certain of this.
3
8230
by: SuryaPrakash Patel via SQLMonster.com | last post by:
Hello, There are three tables: OS-GroupOFCompanies (Table1) GoC_GroupOFCompaniesID (PK) OS-Organization (Table 2) Org_OrganizationID (PK)
0
2703
by: misscrf | last post by:
I am currently working on a database, in 3rd normal form, which is for candidates who apply for a job with the law firm that I workd for. My issue is with good form design. I have a main form. Then I have 3 pages on a tab control ( 4 if the type of candidate validates that is is to be shown) Each page has a subform. The subforms can be either single or continuous, I think I am still deciding what I want to lock down this entry...
11
4533
by: dskillingstad | last post by:
I've been struggling with this problem for some time and have tried multiple solutions with no luck. Let me start with, I'm a novice at Access and I'm not looking for someones help to design my database,just help in getting me pointed in the right direction. I have a database with 8 tables, which from what I have read, cannot be linked on a single form, and be updatable. I have created a query which includes all 8 tables, and then...
8
10417
by: Jason L James | last post by:
Hi all, does anyone know if I can create a dataview from multiple datatables. My dataset is constructed from four separate tables and then the relationships are added that link the tables together. To make data entry easier I would like to combine selected columns from the four tables onto a single dataview that could be used as the datasource for a datagrid control. The distinct updates, insert ans delete
11
3680
by: shriil | last post by:
Hi I have this database that calculates and stores the incentive amount earned by employees of a particular department. Each record is entered by entering the Date, Shift (morn, eve, or night) and the 'employee name'. There is another table which assigns an ID to the Shifts, i.e. 1,2 and 3 for morn, eve & night shifts respectively. From the mother table, the incentive is calculated datewise for each employee as per his shift duty. In...
3
1787
by: BASSPU03 | last post by:
I had to present my DB today, but was granted a chance to fix something about it. In order to fix something, I added something...something that is giving me more trouble than it should. I have to present again tomorrow. Quick assistance would be greatly appreciated. I have three forms (one main form and two subforms) with the following fields: frmResultsFY FiscalYear sfrmResultsAgencies FiscalYear Agency
0
1649
by: cannonpm | last post by:
Greetings and salutations. I have developed an A2K3 MDB and have a search form modeled after Allen Browne's search form (http:// allenbrowne.com/ser-62.html). It works well except for records which have multiple related records in 1:many relationships and many:to:many relationships. To view my results, I created a query called qryAllData which contains all of the data from several tables for each record. For example, say I have one...
3
2588
by: 6afraidbecause789 | last post by:
Think school - students - discipline interventions - misbehaviors - staff for this one....On a mainform frmStudentInterventions, I have linked a subform (sfrmMisbehaviors) with another subform (sfrmInterventions) with the Child and Master fields "InterventionID." This is tested and works - as users click through the continuous list of interventions, the continuous list of misbehaviors changes per intervention. Now, I need to link another...
0
9471
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10302
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10136
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10071
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7478
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6723
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5372
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5501
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3631
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.