473,467 Members | 1,898 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Mulitple Main Forms Created by Sub Form Entries

Hi

I'm hoping this is a problem just because I'm a beginner at Access,
and so someone can help

I have created a database of companies, with a subform for contacts.
(seperate tables)

It worked perfectly until I got more than one contact for a company!

If I add a 2nd contact to the subform, when I go back into the
database, Ive got 2 records of the main form for the company, with the
subform, showing.

Its not adding a second record to the company table, that just says I
have 2 contacts attached, which is what I want.

How do I stop the record, when I view the form , duplicating itself
each time I add a second contact.

I've tried just deleting one of the records, but that deletes one of
the contacts as well (as I suppose effectively I've got one record for
each contact showing ?).

Thank you

Tracy
Nov 12 '05 #1
3 1525
Tracy wrote:
Hi

I'm hoping this is a problem just because I'm a beginner at Access,
and so someone can help

I have created a database of companies, with a subform for contacts.
(seperate tables)

It worked perfectly until I got more than one contact for a company!

If I add a 2nd contact to the subform, when I go back into the
database, Ive got 2 records of the main form for the company, with the
subform, showing.

Its not adding a second record to the company table, that just says I
have 2 contacts attached, which is what I want.

How do I stop the record, when I view the form , duplicating itself
each time I add a second contact.

I've tried just deleting one of the records, but that deletes one of
the contacts as well (as I suppose effectively I've got one record for
each contact showing ?).

Thank you

Tracy

You are invited to read on the subject 'normalization'. Here, you need
another table, that contains the primary key of the company (some
number, I hope) AND let's say the type of contact, or maybe just an
identifier for the contact, alongside all other information for the contact.

--
Bas Cost Budde
http://www.heuveltop.nl/BasCB

Nov 12 '05 #2
Tracy wrote:
Hi

I'm hoping this is a problem just because I'm a beginner at Access,
and so someone can help

I have created a database of companies, with a subform for contacts.
(seperate tables)

It worked perfectly until I got more than one contact for a company!

If I add a 2nd contact to the subform, when I go back into the
database, Ive got 2 records of the main form for the company, with the
subform, showing.

Its not adding a second record to the company table, that just says I
have 2 contacts attached, which is what I want.

How do I stop the record, when I view the form , duplicating itself
each time I add a second contact.

I've tried just deleting one of the records, but that deletes one of
the contacts as well (as I suppose effectively I've got one record for
each contact showing ?).

Thank you

Tracy


Your Company table should have a primary key. I recommend an autonumber.
Your contacts table should also have a primary key that is an autonumber
and it will contain the same name as the Company primary key. This is
called a foreign key and with it you can set a relationship between 2
tables; Company being the One's side (1 record per company) , Contacts
being the Child being the Many side (many records for 1 company.

Your main form would be the company form. A subform, with the link, would
be the company id. If you are using a query to join both of them together
I would suggest you change that.

IOW, create a form for just the master (Company) and create another
separate form for Child (Contacts). Open up the Company form, click the
Subform and select the Contact form. That should solve your problem.
Nov 12 '05 #3
Thanks 'salad', that worked perfectly!

Problem solved!!

Thank you

Tracy

Salad <oi*@vinegar.com> wrote in message news:<40***************@vinegar.com>...
Tracy wrote:
Hi

I'm hoping this is a problem just because I'm a beginner at Access,
and so someone can help

I have created a database of companies, with a subform for contacts.
(seperate tables)

It worked perfectly until I got more than one contact for a company!

If I add a 2nd contact to the subform, when I go back into the
database, Ive got 2 records of the main form for the company, with the
subform, showing.

Its not adding a second record to the company table, that just says I
have 2 contacts attached, which is what I want.

How do I stop the record, when I view the form , duplicating itself
each time I add a second contact.

I've tried just deleting one of the records, but that deletes one of
the contacts as well (as I suppose effectively I've got one record for
each contact showing ?).

Thank you

Tracy


Your Company table should have a primary key. I recommend an autonumber.
Your contacts table should also have a primary key that is an autonumber
and it will contain the same name as the Company primary key. This is
called a foreign key and with it you can set a relationship between 2
tables; Company being the One's side (1 record per company) , Contacts
being the Child being the Many side (many records for 1 company.

Your main form would be the company form. A subform, with the link, would
be the company id. If you are using a query to join both of them together
I would suggest you change that.

IOW, create a form for just the master (Company) and create another
separate form for Child (Contacts). Open up the Company form, click the
Subform and select the Contact form. That should solve your problem.

Nov 12 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: GrelEns | last post by:
hello, i have a website to do which will needs many forms, and i'm looking for an elegant way to handle them... i would like to know how do you use php and forms , how do you validate user...
0
by: Steve Jorgensen | last post by:
One thing that makes Access so useful rapid development tool is the seemless way it links user interfaces to data storage. That is also one of its most maddening weaknesses, since Access doesn't...
3
by: Ray Stevens | last post by:
How do you access properties of the main program's class from another form? There does not apear to be an instance variable that can be used.
2
by: Martin | last post by:
Hi, I want mulitple html forms on one ASP.Net page. I guess it's invalid HTML to nest form elements, which is okay for me. My concern is that ASP.Net will not work well if I override the...
1
by: code3_brent | last post by:
Moving from VB6 to VB.NET or C# and had a general design question... I currently have a VB6 app that functions like a wizard. Form1 is displayed with configuration settings. The user enters the...
7
by: Terry | last post by:
I have a Mainform with a Statusbar. When opening another form or doing some processing I want to display info in the Statusbar of the Mainform. I have read a lot of articles on this & have come up...
2
by: jackson2005 | last post by:
OK, I need to do three different things. On the ONLOAD event I would like a popup box to open. In this popup box I need two text boxes. One for the UserName and one for the BillingTo name. ...
3
by: Jon | last post by:
My main form opens up another form, and from this other form, I'd like to access things in the main form. The problem is that although I know the name of the class of the main form (FormMain) I...
5
by: Thelma Roslyn Lubkin | last post by:
I am still having trouble trying to use a popup form to allow user to set filters for the main form. The main form is based on a single table. The popup contains 5 listboxes, so the user can...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
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,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.