Form will not add new record

H

heatherc

Hi There,

I am having trouble with my form adding new records. The form is based on a
query that uses one table from the current database and another table linked
from another database. The form also has five subforms.

The query for the form is a left join select query that is editable. The
linked table has about 30,000 student records, but the table from the current
database has only about 2,500 records. Basically, the query is used to look
up the student's name and other academic information from the linked table
while the table in the current database only contains the records of students
in an honors program with specific honors program fields tracked by the
current database. Everything is keyed off the student's ID number.

If a student's record doesn't exist on the honors side, I would input the ID
number on the form and then run Me.Requery as an AfterUpdate function for the
ID field to pull in the data from the linked table. This was working great,
but all of a sudden it now gives me the error message: "The changes you
requested to the table were not successful because they would create
duplicate values in the index, primary key, or relationship. Change the data
in the field or fields that contain duplicate data, remove the index, or
redefine the index to permit duplicate entries and try again". I have no
idea why it was working before and now it doesn't.

I can add records to the query and underlying tables just fine. The form
allows edits of existing records, but each new record is not allowed as a
duplicate. The ID number most certainly does exist in the linked table (the
whole idea is to pull in that data), but the ID does *not* exist in the
honors table and that is the table where the ID field is coming from. I've
been searching for days for some kind of answer and the only thing that
sounded even remotely similar suggested creating a subform. I already have 5
subforms and it's not very user-friendly to have the student's name and other
identifying information on yet another subform. I don't want duplicates, and
removing the index didn't work anyway.

Help!
 
J

Jeanette Cunningham

Hi heatherc,
When I try to fix something like this, I will create a test form.
For this, create a test form, but don't add the subforms.
Without complications from any subforms, you can see what else in the code
might be causing the problem.
It's also possible that the form is starting to show signs of corruption.
Have a look here for info about corruption
http://allenbrowne.com/ser-25.html

Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top