Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Update trigger question
Message
 
 
To
27/02/2001 04:03:08
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00479925
Message ID:
00480069
Views:
14
>How can i replace a field with datetime() in the update triger?
>Thanks.

You can not update the value of any field in an update trigger of a VFP table. This like an endless loop.

First edit the Stored Procedures of the DBC. Create a procedure called SetDate --

procedure SetDate
*
lparameter tcField
if vartype(tcField) <> "C" or empty(tcField)
tcField = "LastUpdate"
endif
tcField = upper(alltrim(tcField))
local llFound, i
for i = 1 to fcount()
if upper(field(i)) == tcField
llFound = .t.
exit
endif
endfor
if llFound
replace (tcField) with Date()
endif
return .t.

For the table, put SetDate('LastUpdate') in the Record Validation Rule of the table. Substitute your data field name for LastDate. Now everytime a field is modified in that table the LastUpdate field of the table will be set to the current date.
Mark McCasland
Midlothian, TX USA
Previous
Reply
Map
View

Click here to load this message in the networking platform