How can I edit records?

J

jenna

Hi,

I'm using Access 2002. But I can't edit or delete a record in a form because
other table includes related record. Is there a way around this?? Because a
database would be of very limited use if records cannot be edited or deleted!
 
J

JohnFol

But they are locked for a reason, probably because an edit would invalidate
the relationship, or you are trying to update the wrong side of the
relationship.

Have a look in the online help for

"When can I update data from a query? (MDB)"

If you still think you should be able to update, post a summary of the
tables in the query, how they are joined and I'm sure someone could put the
reasons in context.
 
S

Sam Kuo

Thanks John. I will have a look at the online help you suggest :)


JohnFol said:
But they are locked for a reason, probably because an edit would invalidate
the relationship, or you are trying to update the wrong side of the
relationship.

Have a look in the online help for

"When can I update data from a query? (MDB)"

If you still think you should be able to update, post a summary of the
tables in the query, how they are joined and I'm sure someone could put the
reasons in context.
 
B

BruceM

For your ability to edit you may want to check form properties to be sure
edits are allowed. Check relationships to see if "cascade delete related
records" is allowed. For the reason it is not allowed, consider the example
of an Orders table and and Orders Detail table. If you delete an order you
need to delete related Order Details; otherwise Order Details will no longer
related to an order, and will become meaningless. Taken the other way, you
should be able to delete an Order Detail. Without knowing anything about
your database or the exact nature of the difficulty it is impossible to be
more specific.
 
J

jenna

Hi John,

Thanks for your reply. I have looked at the online help, and now have better
idea about the use of Enforce Referential Integrity.

For example:
I have a form frmDWG based on qryDWG with a subform frmSales based on
qrySales which records all sale history, and a second form frmArtist based on
qryArtist which details artist's profile. For any drawing record, the user
can open a separate form frmArtist where the ArtistName field matches.

I've set Cascade Update Related Fields and Cascade Delete Related Records
between tblDWG and tblSales, so that if a drawing record is deleted the sales
hostory would be deleted as well. But then since I am not able to set the
same relationship enforcements bewteen tblDWG and tblArtist (or between
tblSales and tblArtist), I untick Enforce Referential Integrity, and hence I
can now edit records in frmArtist.

However, I was hoping to be able to change ArtistName in frmArtist and that
the ArtistName field in frmDWG would update such change. Is this possible
without having Cascade Update Related Fields and Cascade Delete Related
Records relationship between tblDWG and tblArtist?
 
J

jenna

Hi John,

Thanks for your reply. I have looked at the online help, and now have better
idea about the use of Enforce Referential Integrity.

For example:
I have a form frmDWG based on qryDWG with a subform frmSales based on
qrySales which records all sale history, and a second form frmArtist based on
qryArtist which details artist's profile. For any drawing record, the user
can open a separate form frmArtist where the ArtistName field matches.

I've set Cascade Update Related Fields and Cascade Delete Related Records
between tblDWG and tblSales, so that if a drawing record is deleted the sales
hostory would be deleted as well. But then since I am not able to set the
same relationship enforcements bewteen tblDWG and tblArtist (or between
tblSales and tblArtist), I untick Enforce Referential Integrity, and hence I
can now edit records in frmArtist.

However, I was hoping to be able to change ArtistName in frmArtist and that
the ArtistName field in frmDWG would update such change. Is this possible
without having Cascade Update Related Fields and Cascade Delete Related
Records relationship between tblDWG and tblArtist?
 
J

jenna

Hi Bruce,

Thanks for your reply. Here is my example (simplified a bit though)..

For example:
I have a form frmDWG based on qryDWG with a subform frmSales based on
qrySales which records all sale history, and a second form frmArtist based on
qryArtist which details artist's profile. For any drawing record in frmDWG,
the user can open a separate form frmArtist where the ArtistName field
matches.

I've set Cascade Update Related Fields and Cascade Delete Related Records
between tblDWG and tblSales, so that if a drawing record is deleted the sales
history would be deleted as well. But then since Access won't let me
establishing the same relationship enforcements bewteen tblDWG and tblArtist
(or between tblSales and tblArtist), I untick Enforce Referential Integrity
(i.e. get rid of the one-to-many relationship), and hence I can now edit
records in frmArtist.

However, I was hoping to be able to change an ArtistName in frmArtist and
that the ArtistName field in frmDWG would update such change. Is this still
possible without having Cascade Update Related Fields and Cascade Delete
Related Records relationship between tblDWG and tblArtist?
 
B

BruceM

It seems to me that each artist can have many drawings, and that each drawing
can have many entries in its history. I can't tell from your reply if you
have established relationships between these three tables. Cascade updating
or deleting related fields or records depends first on the relationships.
To set up a relationship the parent table needs a primary key. If the
artist table is the parent table and the drawing table the child table, and
if the artist's name changes, then any drawings by that artist can now be
associated with the artist's new name. The point is that you store the
primary key, not the artist's name in the related table (unless you want to
store the artist's name as it was at the time the artwork was created). If
you are using an autonumber primary key it makes no difference if you set up
the relationship to cascade update related fields. If, however, you are
using a value that could change then you need to check that option.
In your case I'm not sure why you would want to delete a record (assuming
the records are not accidental duplicates or something of the sort). If you
delete an artist record then every drawing by that artist will also be
deleted if you choose to cascade delete related records.
You say that you want to change the artist name on the form, but remember
that the form is only a sort of portal to the table. You are using the form
to modify the table. If you modify the artist's name in the artist table,
that change may subsequently be viewed in forms or reports.
If you need suggestions that apply specifically to your situation then
please post your table structure. You don't need to post a lot of details.
The names of the primary and foreign key fields, and a brief description of
the table's purpose (e.g. "Artist personal information") will be enough.
 
Top