I confess I never used triggers or RI with VFP tables. I would rather use my 
own logic and code whatever is needed to achieve the same result.

Reasons: whenever I tried to figure out the built in code for RI that comes 
with VFP I found myself at a loss to understand it. It is far too complicated. 
Besides, whatever error messages it displays are in English and, in this 
country, my users speak Spanish.

Another reason is that I prefer to have full control over my code, so I write 
my own routines to deal with referential integrity.

However, only last week I created a new table and wanted to experiment with the 
triggers. I simply wanted to set up Add, delete and modify triggers for one 
field, a datetime field called DT.

What I did is put the datetime() function in each of the trigger fields. My 
intention was that whenever I add, modify or delete a record in this table, the 
DT field would be updated with the current datetime.

I get an error message: cannot modify record because the table is readonly.

Is this by design and if so, why?
Is there a workaround?

(I know, I can code that in my form, but was wondering whether triggers would 
do)

Please, clarify.

Rafael Copquin

  ----- Original Message ----- 
  From: Garrett Fitzgerald 
  To: [EMAIL PROTECTED] 
  Sent: Friday, May 30, 2008 2:16 PM
  Subject: Re: Relationships and referential integrity


  That scares me on general principles. I think it would be much better to
  write application logic to check if there are lines left: after all, you
  could be deleting records and adding new ones, right?

  But you could probably do that with a Delete Trigger on the child table if
  you really had to.

  On Fri, May 30, 2008 at 12:54 PM, John J. Mihaljevic <
  [EMAIL PROTECTED]> wrote:

  > Hi all,
  >
  > In a one-to-many relationship, I can easily see how to automatically delete
  > any child records when the corresponding parent record is deleted.  But how
  > is this done in reverse?  When the final child record of a relationship is
  > deleted, can the parent record automatically be deleted in some way?  The
  > example I'm using is an order.  When the final detail line of the order is
  > completed (and the record is deleted from the OrderDetail table), I'd like
  > the order header to automatically be deleted from the OrderHeader table.
  >


  --- StripMime Report -- processed MIME parts ---
  multipart/alternative
    text/plain (text body -- kept)
    text/html
  ---

[excessive quoting removed by server]

_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/[EMAIL PROTECTED]
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to