This topic is locked

Before Record Update Event for Edit page

7/17/2015 10:45:48 AM
ASPRunnerPro General questions
G
guntherg author

Hi All,
I want to add an event to the Edit page that if a record is marked as processed, that record's changes are not saved. I am attempting to block any changes made on the Edit page by adding an event under the Before Record Update, that if there is a value in the processed date field (ProcDate), it won't let you save the changes. Attached are some screen shots of the Editor and Events screens in ASPRunnerPro.



With this event, I am comparing to see if ProcDate (Processed Date) is greater that the Dates of Srvc (Service Date), and if so, set BeforeEdit = False. When testing this event function, no matter what the condition, it allows the record to be updated. I have also tried using the following variations if statements to accomplish this function, to no success.
if Not IsNull(value("ProcDate")) then
if Not IsNull(CDate(dict("ProcDate"))) then
if values("ProcDate")>values("Dates of Srvc") then
if CDate(dict("ProcDate"))>CDate(dict("Dates of Srvc") then
(*The last example also clears the ProcDate field when updating.) If I set both sides of the if statement to BeforeEdit = False, it does cause the record not to be updated, so basically my if statement is always returning false when testing the value of the ProcDate field. After 4 hours of trial and error, I'm stumped. Any ideas as to what I am doing wrong? Any suggestions on a better way to create the function I'm looking for? Thanks in advance for any assistance.

M
Maurits 7/18/2015

Have you tried using DateDiff ?
Dim varNow, expTime 'create variable that will store date and time
varNow=Now 'the Now function returns the date & time - assign it to the variable

expTime="05/11/2010 13:00:00"
Response.Write(CDate(expTime)) & "
"

Response.Write(CDate(varNow)) & "
"
'IF Cdate(varNow) > cdate(expTime) THEN Response.Write DateDiff("d",CDate(expTime),CDate(varNow)) & "
"
IF DateDiff("d",CDate(expTime),CDate(varNow))< 0 then

Response.write "<a class=""button"" href=""javascript:popWin('place-bid.asp','250','320')"">Place Bid</a>"

ELSE

Response.write "<span style=""color:#cc0000; font-weight:bold; font-style:italic"">Auction has ended.</span>"

END IF

admin 7/19/2015

Gene,
you need to contact support directly. I don't know what kind of help I can provide here without seeing your data and code.