13 Replies - 7904 Views - Last Post: 12 January 2015 - 12:26 PM

#1 Invoker   User is offline

  • D.I.C Head
  • member icon

Reputation: 32
  • View blog
  • Posts: 165
  • Joined: 29-April 14

The record cannot be deleted or changed because....

Posted 11 January 2015 - 05:34 PM

New to Databases and I'm confused on this error in Microsoft Access. It's saying that "The record cannot be deleted or changed because table "GRADE" includes related words records. I get what it's trying to say to me, but I'm not sure how to go about solving this problem without deleting my relationships.

Someone can explain this to me?
Posted Image

This post has been edited by Invoker: 11 January 2015 - 05:39 PM


Is This A Good Question/Topic? 0
  • +

Replies To: The record cannot be deleted or changed because....

#2 astonecipher   User is offline

  • Senior Systems Engineer
  • member icon

Reputation: 3071
  • View blog
  • Posts: 11,779
  • Joined: 03-December 12

Re: The record cannot be deleted or changed because....

Posted 11 January 2015 - 06:24 PM

I don't deal with access, but, how are your relationships defined? Is the grade table a parent table and not a child table?
Was This Post Helpful? 0
  • +
  • -

#3 Invoker   User is offline

  • D.I.C Head
  • member icon

Reputation: 32
  • View blog
  • Posts: 165
  • Joined: 29-April 14

Re: The record cannot be deleted or changed because....

Posted 11 January 2015 - 07:28 PM

Well the grade table is taking compound primary keys from the STUDENT table and the CLASS table. I'm fairly new to databases and Access, so I'm not sure of the entire lingo.
Was This Post Helpful? 0
  • +
  • -

#4 astonecipher   User is offline

  • Senior Systems Engineer
  • member icon

Reputation: 3071
  • View blog
  • Posts: 11,779
  • Joined: 03-December 12

Re: The record cannot be deleted or changed because....

Posted 11 January 2015 - 08:09 PM

The table structure should look something like...


tbl_grade
student_id | class_id | grade

correct?
Was This Post Helpful? 0
  • +
  • -

#5 Invoker   User is offline

  • D.I.C Head
  • member icon

Reputation: 32
  • View blog
  • Posts: 165
  • Joined: 29-April 14

Re: The record cannot be deleted or changed because....

Posted 11 January 2015 - 09:02 PM

This is what it looks like; not sure if that's what you're attempting to explain to me.

Posted Image
Was This Post Helpful? 0
  • +
  • -

#6 astonecipher   User is offline

  • Senior Systems Engineer
  • member icon

Reputation: 3071
  • View blog
  • Posts: 11,779
  • Joined: 03-December 12

Re: The record cannot be deleted or changed because....

Posted 11 January 2015 - 09:07 PM

Okay, my mind is to hazy working out the logic of my current system, but...

The way your table is currently designed, you would only be able to delete a row from the grade table, if you first deleted the linking information from the class table.

It is a design issue.

What category is this project in? (IE, fun, class/ homework, production environment) That plays a role with how detailed the diagram needs to get to be scalable.
Was This Post Helpful? 0
  • +
  • -

#7 Invoker   User is offline

  • D.I.C Head
  • member icon

Reputation: 32
  • View blog
  • Posts: 165
  • Joined: 29-April 14

Re: The record cannot be deleted or changed because....

Posted 11 January 2015 - 09:47 PM

This is literally like the first assignment we have in this Database systems course. This is the only problem I'm having currently because when I make the table look like that it doesn't want to save because of the error. I don't want to delete anything; what I'm trying to figure out is why it's giving me this error in the first place.

I'd attach the file to this, but it isn't letting me save in the first place, so I hope what I'm saying makes sense.

This post has been edited by Invoker: 11 January 2015 - 10:02 PM

Was This Post Helpful? 0
  • +
  • -

#8 astonecipher   User is offline

  • Senior Systems Engineer
  • member icon

Reputation: 3071
  • View blog
  • Posts: 11,779
  • Joined: 03-December 12

Re: The record cannot be deleted or changed because....

Posted 11 January 2015 - 10:15 PM

What table are you attempting to update?
Was This Post Helpful? 0
  • +
  • -

#9 Invoker   User is offline

  • D.I.C Head
  • member icon

Reputation: 32
  • View blog
  • Posts: 165
  • Joined: 29-April 14

Re: The record cannot be deleted or changed because....

Posted 11 January 2015 - 10:47 PM

The form that I'm currently doing isn't a table at all; it's supposed to be a form using data from the tables.
Was This Post Helpful? 0
  • +
  • -

#10 andrewsw   User is offline

  • never lube your breaks
  • member icon

Reputation: 6833
  • View blog
  • Posts: 28,344
  • Joined: 12-December 12

Re: The record cannot be deleted or changed because....

Posted 12 January 2015 - 06:11 AM

What were you trying to delete from your form, the student or the class? If either the student or the class are already involved in the GRADE table then, as the error message says, you cannot delete the student or class.

If you haven't already assigned some grades then it may be the query (or queries, or some code) behind the form that is creating a GRADE record.

This post has been edited by andrewsw: 12 January 2015 - 06:42 AM

Was This Post Helpful? 0
  • +
  • -

#11 astonecipher   User is offline

  • Senior Systems Engineer
  • member icon

Reputation: 3071
  • View blog
  • Posts: 11,779
  • Joined: 03-December 12

Re: The record cannot be deleted or changed because....

Posted 12 January 2015 - 06:27 AM

Thanks Andrew, that's what I was trying to articulate.


You are using the form, but it is interacting with the tables. So, if you are trying to update a class id, but it is already assigned in the grade table, you cant because of the dependency.
Was This Post Helpful? 0
  • +
  • -

#12 Invoker   User is offline

  • D.I.C Head
  • member icon

Reputation: 32
  • View blog
  • Posts: 165
  • Joined: 29-April 14

Re: The record cannot be deleted or changed because....

Posted 12 January 2015 - 11:55 AM

Alright I get that it can't be updated because of the dependencies and whatnot, however, because of this I'm unsure if answering this problem is even possible. The task requires that my form be duplicated to look like the one in the book. I wasn't trying to delete anything - more like edit the fields in the form, which would - I assume - be adding/acquiring data from the tables. I can get it to slightly look like it, but the moment I enter the information in the form I get this error.

(Sorry if this seems like I'm endlessly asking the same question, but the Microsoft Access helper recommends deleting relationships and whatnot, but I'm not supposed to do that)


This is what it's supposed to look like:
Posted Image

This is what mines look like without inputting information into the form:
Posted Image

With input and error:
Posted Image

Even after changing the fields back to their original parameters the error still appears. I do not understand why this is happening.

This post has been edited by Invoker: 12 January 2015 - 11:57 AM

Was This Post Helpful? 0
  • +
  • -

#13 astonecipher   User is offline

  • Senior Systems Engineer
  • member icon

Reputation: 3071
  • View blog
  • Posts: 11,779
  • Joined: 03-December 12

Re: The record cannot be deleted or changed because....

Posted 12 January 2015 - 12:15 PM

Like I said, I don't do Access...


Can you alter the cascade for the tables? example, on update ... on delete ... ?

What it is trying to prevent, if you change the classnumber from 4 to 40. But, you have students that are linked to classnumber 4, it would orphan them. So it needs to be set that any updates you do on a table, cascades to the related tables.
Was This Post Helpful? 0
  • +
  • -

#14 Invoker   User is offline

  • D.I.C Head
  • member icon

Reputation: 32
  • View blog
  • Posts: 165
  • Joined: 29-April 14

Re: The record cannot be deleted or changed because....

Posted 12 January 2015 - 12:26 PM

Well I can. I just went ahead and selected them both, but I still get an error that says its can't perform the cascade operation because it would produce a duplicate key in the table.

Posted Image
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1