|
-
February 14th, 2000, 09:12 AM
#1
Delete record from table with Relationship
Hello.
I want to delete record from table (in access).
I use this line : data.recordset.delete
when i the program get to this line it make an error that say:
"can not delete record because it related to..(name of table)"
How can i delete this record ?
Thanks for help.
-
February 14th, 2000, 09:22 AM
#2
Re: Delete record from table with Relationship
When using relationships, you cannot delete a record with has a reation to another table, you must first delete the record in the table wich refers to it, eg:
We have two table, A contains the name, address and number of gender (eg: 0 = male, 1 = female)
They are linked with gender(A) and gNumber(B). Like this
[table A] [table B]
name |--gNumber
address | gName
gender ---|
When you try to remove like say '1 female' out of table B, you must be sure that there are NO records in table A wich have a gender 1. Only if there are no females in table A, you will be allowed to delete the record.
eg:
If table A contains following data
Tom Cannaerts - Somewhere in Belgium - 0
Pamela Anderson - Somewhere in US - 1
And Table B contains
0 - male
1 - female
you will not be able to delete the recode 1 - female, because in table A, we have Pamela, a female.
However, if there was no Pamela, nor any other females in table A, you can delete it.
Tom Cannaerts
[email protected]
The best way to escape a problem, is to solve it.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|