Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Foxpro triggers...

Status
Not open for further replies.

Aseem1234

Programmer
Nov 26, 2003
33
0
0
US
If anyone could send links for information about Foxpro triggers, I would greatly appreciate it. I am trying to create a eventLog class that will log various actions of the user, e.g. if the user deletes a order or edits a customer profile...has anyone done this before? How did you implement your solution?

Thanks,

Aseem
 
Aseem,

This sounds completely straightfoward.

First, can we assume that your tables are in a DBC? If not, the first step is to add them to a DBC, since free tables do not support triggers.

Next, you need to write a procedure which writes to the event log. Just use ordinary VFP code for that. Although you can store the procedure in a PRG file, it is usual to place it in the stored procedures of the DBC.

Finally, you need to call that procedure from the three triggers of the table that you want to log. Open the table's design screen, go to the table properties page, and write three simple calls to your procedure in the update trigger, insert trigger and delete trigger boxes. In each case, the trigger will look like this:

LogUpdate()

where LogUpdate is the name of your stored procedure. Also, be sure that the procedure does not return a value (or returns .T.).

That's a very simple explanation, but I hope it will give you a start. Come back if you have any specific questions.

Mike


Mike Lewis
Edinburgh, Scotland

My Visual Foxpro web site: My Crystal Reports web site:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top