our users want to update records in browse window but we need to automatically update a date field and a modby field when they change a record. How can this be done?

Re: Updating a field in Browse by Paul

Paul
Fri May 21 12:59:36 CDT 2004

Use update triggers in the database. Of course, the table has to be IN a
database...


--
Reply to (make the obvious corrections):
p p m b 2 0 0 4 - 2 0 0 4
at
y a h 00





"Tony" <tony.robins@failteireland.ie> wrote in message
news:8F1DC3D5-3DAB-4434-81FC-CC358770AEFC@microsoft.com...
> our users want to update records in browse window but we need to
automatically update a date field and a modby field when they change a
record. How can this be done?



Re: Updating a field in Browse by Rick

Rick
Fri May 21 13:20:36 CDT 2004

Paul,
Of course the date field CAN'T be in the same table as the updated =
field, as this would violate a basic trigger principle!

Rick

"Paul Pedersen" <no-reply@swen.com> wrote in message =
news:utpmh11PEHA.2536@TK2MSFTNGP10.phx.gbl...
> Use update triggers in the database. Of course, the table has to be IN =
a
> database...
>=20
>=20
> --=20
> Reply to (make the obvious corrections):
> p p m b 2 0 0 4 - 2 0 0 4
> at
> y a h 00
>=20
>=20
>=20
>=20
>=20
> "Tony" <tony.robins@failteireland.ie> wrote in message
> news:8F1DC3D5-3DAB-4434-81FC-CC358770AEFC@microsoft.com...
> > our users want to update records in browse window but we need to
> automatically update a date field and a modby field when they change a
> record. How can this be done?
>=20
>

Re: Updating a field in Browse by Cindy

Cindy
Fri May 21 14:14:21 CDT 2004

In news: 8F1DC3D5-3DAB-4434-81FC-CC358770AEFC@microsoft.com,
Tony <tony.robins@failteireland.ie> wrote:
> our users want to update records in browse window but we need to
> automatically update a date field and a modby field when they change
> a record. How can this be done?

Hi Tony,

Check out the Valid clause of the Browse command. Here's some code I have
that's similar to what you want:


BROWSE NOWAIT TITLE "Univeristy Payroll Distribution" ;
NOAPPEND NOMENU IN WINDOW Brow1 ;
FIELDS BFR10 :W=.F., ;
Fund :P="@! NNN-NNNN" :V=LastUsed() AND FundValid(.T., [PyrlDist]), ;
OBJECT :V=LastUsed(), ;
Component :V=LastUsed(), ;
Percent :V=LastUsed(), ;
Cost=ROUND((PedPyrl.UnivCuRate+PedPyrl.AwdCuRate)*PedPyrl.FyHours* ;
Percent/100*PedPyrl.WorkSched/40, 2) :10 :W=.F., ;
Fte = ROUND(Percent/100*PedPyrl.WorkSched/40, 2) :5 :W=.F., ;
EndDate :W=.F., ;
UserID :W=.F., LastUpdt :W=.F. ;
COLOR RGB(0, 0, 128, 255, 255, 255) ;
FOR PyrlDist.EmpId = PedDemog.EmpId


LastUsed() looks like this:

*!* Assumes proper table is selected
*!* Called by valids in browses

FUNCTION LastUsed

REPLACE Userid WITH PedUsers.UserId, LastUpdt WITH DATE()

RETURN .T.
--
Cindy Winegarden MCSD, Microsoft Visual FoxPro MVP
cindy.winegarden@mvps.org www.cindywinegarden.com




Re: Updating a field in Browse by tony

tony
Mon May 24 04:31:01 CDT 2004

Thank you Cindy. It works perfectly. Documentation does say that the VALID statement does record level validation as opposed to the :V which does field validation, but I could not seem to get this to work.
THanks for the help