I have a small but irritating problem when using COLUMNVALID in a GRID. The logic works fine and I am able to display an error message when the date entered is invalid. What I want to get rid of is the pop-up message that follows my error message (the one that says "Invalid Entry").
This is the code block that validates a date entry. It sends the new date (THIS.CELLVALUE) and a date to validate against which is contained in a combobox (Win_User.Cbo_WeekEnd.VALUE) to a function called ValJobDate(). This is where the date is validated and an error message displayed. This works perfectly EXCEPT when an invalid date is found. When that happens, my error message is displayed, the ValJobDate() function ends and then I get the "Invalid Entry" message.
Can anyone point me in the right direction to find a way to stop this from happening?
Thanks. Zimbo
Code: Select all
COLUMNVALID { { || ValJobDate(THIS.CELLVALUE, CTOD(aWeeks[Win_User.Cbo_WeekEnd.VALUE])) } , , , , , , , }
Code: Select all
FUNCTION ValJobDate(dNewDate, dEndDate)
IF EMPTY(dNewDate)
MSGINFO("You must enter a valid date. Please try again.", "Data Validation - Invalid Job Date")
RETURN .F.
ENDIF
IF dNewDate <= dEndDate .AND. dNewDate >= (dEndDate - 6) // Date validation
RETURN .T.
ELSE
MSGINFO("The date you entered cannot be later than " + DTOC(dEndDate) + " or earlier than " + ;
DTOC(dEndDate - 6) + " . Please try again.", "Data Validation - Invalid Job Date")
RETURN .F.
ENDIF
RETURN NIL