473,386 Members | 2,042 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Duplicate records created using two subforms in a main form

77 64KB
I have created a database in microsoft access 2010 to show invoices for different customers in different countries. In doing so, I created using a two subforms in a main form. I have used the "country name" to link the subforms to the main form. When I enter new records into the subforms for a specific country, I realized that a duplicate record of an old record are being created in the subforms. What can I do to prevent this from happening? I tried to change the query link between the main form and subform to "invoice number" but the same problem has occurred.

P.S. I am novice to microsoft access 2010 and any help will be greatly appreciated.
Jun 23 '14 #1

✓ answered by twinnyfo

wirejp,

the way your forms are set up, every time you lok for a country, the subforms are filtering by all the records associated with that country.

First, you shouldn't be filtering those subforms by country, because that is not a uniquely identifiable index. In essence, what your forms are saying is that everyone from France has X insurance X address, X etc. Everyone from New Zealand has Y insurance, Y Address, Y etc.

This may not be what you want your forms to be saying, but that is the impression I get.

If you want something as simple as making sure that when you type in country, you always go to a new record on your subforms, then open your subforms in design mode, and change the "Data Entry" property to True. This will force a new record every time the form opens.

However, I don't think this will solve your long-term problems, as I don't believe your DB is properly normalized and indexed, as jimatqsi alluded to.

10 5006
twinnyfo
3,653 Expert Mod 2GB
wirejp,

Is this a duplicate record in the subform or in the table beneath the subform?

Depending on how you have your subforms linked to your main form, you may just be looking at a pre-existing record.

Please explain better what is happening.
Jun 23 '14 #2
wirejp
77 64KB
hi twinnyfo,

Thank you for your prompt response. Can I can send the database file and the spreadsheet to you for your assistance? If so, kindly send your email to my inbox.

I am at my wits end trying to figure this out. I have browsing the web for solutions and looking at youtube videos for help but I am no wiser.
Jun 23 '14 #3
twinnyfo
3,653 Expert Mod 2GB
No, you cannot send the db, as I can't open it at work. Also it is a violation of this site's policy to request personal e-mail addresses.

If you are a novice, that's OK--I was one, once, too!

But we can work toward a solution if we get more information concerning what is exactly happening.
Jun 23 '14 #4
wirejp
77 64KB
I am trying a database to track insurance premium fee invoices and administrative fee invoices. I created a main form called Premium Header which contain the insurer name and the contact name and address, along with the country name. I then created two subforms called: Premium fee invoices and Admin fee invoices. I had wanted to link the main form to the two subforms by the "country" name because a country can have more than type of insurance policy. Once I started inputting new records in the subforms, I realized that once I entered the "country" name in the main form, the database will suddenly populate the subforms with data from a previous record. So I thought nothing of this and I just manually update the current record with the new insurance invoice data. After inputting each record, I will save the record. It was only after I was scrolling through the records to check the data, that I noticed that in the instances where the same country had more than one record, the database will erase the data in the record and add a duplicate copy of a different recent record for this particular country. I hope this explanation helps.
Jun 23 '14 #5
twinnyfo
3,653 Expert Mod 2GB
wirejp,

the way your forms are set up, every time you lok for a country, the subforms are filtering by all the records associated with that country.

First, you shouldn't be filtering those subforms by country, because that is not a uniquely identifiable index. In essence, what your forms are saying is that everyone from France has X insurance X address, X etc. Everyone from New Zealand has Y insurance, Y Address, Y etc.

This may not be what you want your forms to be saying, but that is the impression I get.

If you want something as simple as making sure that when you type in country, you always go to a new record on your subforms, then open your subforms in design mode, and change the "Data Entry" property to True. This will force a new record every time the form opens.

However, I don't think this will solve your long-term problems, as I don't believe your DB is properly normalized and indexed, as jimatqsi alluded to.
Jun 23 '14 #6
wirejp
77 64KB
I really appreciate your responses. Regarding your above suggestion to change the "Data Entry" property to True in microsoft access 2010, I am not sure where exactly I should go to change this property. I right-clicked on the "country" field box and selected properties. When I looked in the "Data" tab, I see the option "Enabled" as "Yes". Is this what you are referring to?

You are right about the country not being the unique index. The invoice number is the unique field for each invoice. But I did not select this field as the primary key in the either the Premium Fees invoice Table or Admin Fee invoice Table, as I had received an error message stating that "The changes you requested to the table were not successful because they would create duplicate values in the index, primary key, or relationship. Changes in the data in the field or fields that contain duplicate data, remove the index, or redefine the index to permit the duplicate entries and try again". Instead I selected the ID number is the primary key for all of the different tables. When I had created by the two queries for the premium fee invoices and the admin fee invoices, I created a link between the country for the main table and the two subform tables. However, the database characterized this relationship type as "indeterminate" and I was unable to enforce the referential integrity. So I think my database is not properly indexed and normalized as you have stated.
Jun 24 '14 #7
wirejp
77 64KB
I did some research and I think I found the Data entry property: - I right-clicked on the subform, in Design View, and selected the "Form Properties". In the Data tab, I changed the Data entry property from "No" to "Yes". Then I saved the subform. When I switched back to the Form View, all of the records were erased. So I started to manually input the records again. Then I saved the form. When I reopened the form, record was blank. Fortunately, I have a backup copy of the database and the data was not lost. Any help will be greatly appreciated.
Jun 24 '14 #8
twinnyfo
3,653 Expert Mod 2GB
wirejp,

Your records should not have been "erased", just not visible, because you are adding new records. This may not be what you want either. With data entruy, whenever you open the form, there will be no records showing.

It is still difficult to understand exactly what you are trying to do with your form/subforms. It looks like there will be multiple records for each country, but how are you asking the user to go to the particular record that you want?

This is the key to your problem.
Jun 24 '14 #9
wirejp
77 64KB
You are correct. An invoice number relate to a particular country but there may be multiple records for different regions within this country under this invoice number. So I guess that the invoice number is not an unique identifiable index to use. I was thinking about assigning an "PremiumFeeID" or "AdminFeeID" (which will be autonumbers) to each record in the Premium fee subform and Admin fee subform respectively, while the ID number (an autonumber) will be the primary keys. The fields ("PremiumFeeID" and "AdminFeeID") in the subforms will be linked to the main form as the foreign keys while the ID number will be the primary key, when I create the query. Is this a good idea?
Jun 24 '14 #10

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

Similar topics

4
by: Dave Boyd | last post by:
Hi, I have two very similar forms each with a subform. The main form gets a few fields from the user and passes this back to a query that the subform is bound to. The requery is done when the...
18
by: Darryl Kerkeslager | last post by:
I don't do much with subforms - in fact I've deliberately avoided them - but .... I have a tab control that will contain several subforms, each bound to a separate table, and each table/subform...
7
by: Danielb | last post by:
I want my application to run most of the time as just an notify icon visible in the system tray, with some dialogs windows that open if the user selects an option from the context menu on the tray...
2
by: tlyczko | last post by:
I have a main form with 2 subforms, each subform references different data in the same table. How do I make sure each subform only creates NEW records in the referenced table and do not...
2
by: Reginald Bal | last post by:
Hello, I created a main form with 2 subforms. In an attempt to move to the next record (or new record) on the main form I get the error " Method 'requery' of object '_Subform' failed". The...
1
by: Ronniesss1 | last post by:
I have a table called RescheduleIns and another called Shop Complete Table that are opened together on another form called fAll Shop Orders. On this form, all the Shop Complete Table data is...
6
by: Otis492 | last post by:
Hello, I have been struggling with this for a while. I am working on a rather simple database for claims in Access 2003. I have a table called claims that has a primary key field called Claim #. ...
2
Zwoker
by: Zwoker | last post by:
Greetings everyone, I have a problem that I hope has a simple solution. I am using MS Access 2003. I have a table that is a list of financial transactions. I am using a make table query over...
3
by: BASSPU03 | last post by:
My "View All Resources" code is no longer fully suitable for its respective DB form. Now it's not a matter of just opening one form and making it read-only. Now I have a main form with three...
1
by: Gordon Padwick | last post by:
I’m still having a problem with using a combo box in a main form to select records to be displayed in a subform. I’ve tried code suggested in several sources, but it doesn’t work. In “Filter records...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...

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.