Subform-Query Problems

  • Thread starter Konchetta via AccessMonster.com
  • Start date
K

Konchetta via AccessMonster.com

I have read thru many other threads to try and find a solution to my problem
but to no avail. My issue: I have two tables that I am trying to link so that
my 2d table data can be used as a subform on the main form for which all the
data on the 1st table is stored. What I am trying to do with the subform is
to have a datasheet that shows the date of visit..type of 8823 issued..etc
but to correspond to the PROJECT for which the visit is for in the Main Form.
I get the message below.. I have tried to change my query and I have no idea
what I am doing wrong. I have Project Name as my Primary Key in both tables.
I do not have any other unique field. Also, I cannot enter data into the
datasheet or the query, only the table. Please help if you can. I even
thought about just putting all the info in one table but I read where some
say that's not a good idea..

ERROR MESSAGE: "The changes you have 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
entriesand try again."
 
O

orange via AccessMonster.com

Konchetta said:
I have read thru many other threads to try and find a solution to my problem
but to no avail. My issue: I have two tables that I am trying to link so that
my 2d table data can be used as a subform on the main form for which all the
data on the 1st table is stored. What I am trying to do with the subform is
to have a datasheet that shows the date of visit..type of 8823 issued..etc
but to correspond to the PROJECT for which the visit is for in the Main Form.
I get the message below.. I have tried to change my query and I have no idea
what I am doing wrong. I have Project Name as my Primary Key in both tables.
I do not have any other unique field. Also, I cannot enter data into the
datasheet or the query, only the table. Please help if you can. I even
thought about just putting all the info in one table but I read where some
say that's not a good idea..

ERROR MESSAGE: "The changes you have 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
entriesand try again."

I suggest you read a little on data normalization. UNderstand the "things"
you are working with.
Write down a description of each of the things and each of the
properties/attributes. You will understand the data much more than you think.

Get a handle on the business rules-- what happens to create a project,
conduct a visit-- what has to be recorded- what reports/questions will people
need- who are the people....

Also, don't be too concerned with the Form subForm aspect. You have a main
thing -seems to be Project that will ahve attributes of its own. Also you
seem to have a Visit "thing" that will be related to a Project; will occur on
specific Dates; probably have some sort of Purpose; and will likely involve
People.

Get your Tables organized and structured before you start dealing with Form.

There are free data models that may be useful to you available here
http://www.databaseanswers.org/data_models/project_planning/index.htm

Take a look at the Business rules
 
K

Konchetta via AccessMonster.com

Thanks Orange!! Will do that.
I have read thru many other threads to try and find a solution to my problem
but to no avail. My issue: I have two tables that I am trying to link so that
[quoted text clipped - 14 lines]
duplicate data, remove the index, or redefine the index to permit duplicate
entriesand try again."

I suggest you read a little on data normalization. UNderstand the "things"
you are working with.
Write down a description of each of the things and each of the
properties/attributes. You will understand the data much more than you think.

Get a handle on the business rules-- what happens to create a project,
conduct a visit-- what has to be recorded- what reports/questions will people
need- who are the people....

Also, don't be too concerned with the Form subForm aspect. You have a main
thing -seems to be Project that will ahve attributes of its own. Also you
seem to have a Visit "thing" that will be related to a Project; will occur on
specific Dates; probably have some sort of Purpose; and will likely involve
People.

Get your Tables organized and structured before you start dealing with Form.

There are free data models that may be useful to you available here
http://www.databaseanswers.org/data_models/project_planning/index.htm

Take a look at the Business rules
 
K

KARL DEWEY

I have Project Name as my Primary Key in both tables.
You can not have Project as primary key in the project visit table as it
would only allow ONE visit. Use Project as a foreign key.

Join the two table in a one-to-many relationship and set the Master/Child
links for the form/subform using the Project fields.
 
G

golfinray

I would suggest two things. One, if you try to change your PK, it gives you
that error. OR if you have duplicates in your primary key it gives you that
error. Two, I think having project name as the PK may cause some problems
because each project names will have to be an exact match. If someone tries
to change Project for This to Project for That, you get an error. A better
option may be to use an autonumber field for the PK.
 
K

Konchetta via AccessMonster.com

Thanks Karl, I will try that as well. I kept changing Project from my Primary
Key because I felt the problem lied somewhere in me making that my primary
key but nothingelse ever worked. So I will give this a try.

KARL said:
You can not have Project as primary key in the project visit table as it
would only allow ONE visit. Use Project as a foreign key.

Join the two table in a one-to-many relationship and set the Master/Child
links for the form/subform using the Project fields.
I have read thru many other threads to try and find a solution to my problem
but to no avail. My issue: I have two tables that I am trying to link so that
[quoted text clipped - 14 lines]
duplicate data, remove the index, or redefine the index to permit duplicate
entriesand try again."
 
K

Konchetta via AccessMonster.com

Thank golfinray, I tried making my PK an autonumber too but that didn't work
but I did still have my Project Name in both tables. So I will give all this
some careful thinking over to apply to make sure I don't waste any more time.
Thanks a bunch!!

I would suggest two things. One, if you try to change your PK, it gives you
that error. OR if you have duplicates in your primary key it gives you that
error. Two, I think having project name as the PK may cause some problems
because each project names will have to be an exact match. If someone tries
to change Project for This to Project for That, you get an error. A better
option may be to use an autonumber field for the PK.
I have read thru many other threads to try and find a solution to my problem
but to no avail. My issue: I have two tables that I am trying to link so that
[quoted text clipped - 14 lines]
duplicate data, remove the index, or redefine the index to permit duplicate
entriesand try again."
 

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