473,326 Members | 2,805 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,326 software developers and data experts.

Duplicate value in field or relationship

I have a problem with a database which I've recently separated into several
related tables. I have a main data entry form, which has several subforms
on it on tabbed pages. The first subform is actually part of the main data
table, however, when I try to add new data to the form all is OK until I
reach the first tab page which has specific data (still on the main table),
when you try to add data to this part of the form an error message relating
to duplicate values in fields, indexes or relationships occurs.

However, this doesn't happen if you put info in the main part of the form.
Close the form. Open the form again and add the data on the subform now.
All is OK.

I know this must be something simple but I just can't work it out.

Any help???

D
Nov 12 '05 #1
3 1833
"Donna Price" <do*********@tiscali.co.uk> wrote in message
news:40**********@mk-nntp-2.news.uk.tiscali.com...
I have a problem with a database which I've recently separated into several related tables. I have a main data entry form, which has several subforms
on it on tabbed pages. The first subform is actually part of the main data table, however, when I try to add new data to the form all is OK until I
reach the first tab page which has specific data (still on the main table), when you try to add data to this part of the form an error message relating to duplicate values in fields, indexes or relationships occurs.

However, this doesn't happen if you put info in the main part of the form.
Close the form. Open the form again and add the data on the subform now.
All is OK.

I know this must be something simple but I just can't work it out.

Any help???

D


I would imagine that it is to with the fact that the new record has not been
saved. Try saving the record first or putting a button with
Me.Dirty = False
Me.sbfSub1.SetFocus
So the record is saved before taking you to the related record. If this
does the trick, the answer might be to create a custom 'AddNew' button which
creates a new saved record (possibly by popping up a modal unbound form to
get essential details for the new record). Having the standard Access
record navigation controls for form/subform and allowing additions for both
can cause trouble.

If this isn't the cause of the error, let us know.

Fletcher
Nov 12 '05 #2
Thanks for that. I have included a standard wizard-created 'Save' Button on
the form and have used this to save the record before moving to the subform
but the same thing happens. It's only on closing the form and then opening
it again does it allow the data to be added.

Adding the data in datasheet view creates no problems at all, so it
definitely points to the form or it's query. I can't try any other things
until tomorrow as I don't have the file with me. If you have any other
ideas I'd appreciate it. I'm a real 'taught myself novice' at this, I'm
afraid.

Tks
Donna
Nov 12 '05 #3
"Donna Price" <do*********@tiscali.co.uk> wrote in message
news:40********@mk-nntp-2.news.uk.tiscali.com...
Thanks for that. I have included a standard wizard-created 'Save' Button on the form and have used this to save the record before moving to the subform but the same thing happens. It's only on closing the form and then opening it again does it allow the data to be added.

Adding the data in datasheet view creates no problems at all, so it
definitely points to the form or it's query. I can't try any other things
until tomorrow as I don't have the file with me. If you have any other
ideas I'd appreciate it. I'm a real 'taught myself novice' at this, I'm
afraid.

Tks
Donna

Are you sure you need to actually close the form? What about moving back a
record and then going forward agin so you are sure it's saved?

It's hard to say without knowing much about your table structure but it
sounds like there might be a field which is required and no duplicates are
allowed (typically something like tblOrders.OrderNo) and this field has a
default value of zero. When you create a new order, unless you specifically
type the order number in - and perhaps this is hidden away and forgotten on
another tab - the default value of zero is allocated which may already
exist. It's this sort of thing which would cause Access to bleat about
duplicate values.
Fletcher
Nov 12 '05 #4

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

Similar topics

3
by: andreas.maurer1971 | last post by:
Hi all, since a few years I use the following statement to find duplicate entries in a table: SELECT t1.id, t2.id,... FROM table AS t1 INNER JOIN table AS t2 ON t1.field = t2.field WHERE...
1
by: Bert | last post by:
We are using MS Access97. Now by entering a new item to the database the problem occurs. We are using a subform and a form, by clicking a field in the subform the form produces an error regarding...
1
by: Robert | last post by:
How can I query an existing table and update a field in each record in the table with the occurrence count of each record e.g. update field to 1 (= first record occurrence), update field to 2 for...
1
by: Charles Ledbetter | last post by:
I'm missing the mistake. I have a MainForm called frmResources. I have a Second Form and related table called frmFootnotes. I am trying to use it as a subform to the main form appearing in a...
2
by: Mike N. | last post by:
Hello again.. I have a table with a text field named "Requisition" (Indexed, no dupes). It is not the key field. This field is the first text box on a form. I would like to check to make sure the...
8
by: Iona | last post by:
Hi Allan, I'm using a nifty piece of code you put on here some time back to do a duplicate entry check as below. I'm using to check for duplicate names. However I am getting an error message on...
9
by: Tom_F | last post by:
To comp.databases.ms-access -- I just discovered, to my more than mild dismay, that some tables in my Microsoft Access 2003 database have duplicate numbers in the "AutoNumber" field. (Field...
6
by: reppisch | last post by:
Hi Ng, I have a multiset for keeping elements sorted in a container but key values may also be equal. Is there any guaranteed traversal order within the duplicate keys of a multimap? When...
2
by: fabiola1 | last post by:
I'm using Ms Access 2003. I have five tables called tblAllContract tblType tbInteranlContact tblSupplier tblManager The other four tables are linked to tblAllContracts with Id's.I have a...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.