By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,124 Members | 2,054 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,124 IT Pros & Developers. It's quick & easy.

Duplicate value in field or relationship

P: n/a
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
Share this Question
Share on Google+
3 Replies


P: n/a
"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

P: n/a
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

P: n/a
"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 discussion thread is closed

Replies have been disabled for this discussion.