*------------------------------------------------------
*--- If there is no second view parameter, do the
*--- default code.
*------------------------------------------------------
IF EMPTY(This.cViewParameter2)
IF NOT DODEFAULT()
RETURN .F.
ELSE
RETURN .T.
ENDIF
ENDIF
LOCAL llUnique
*-------------------------------------------------------------
*-- Save the current alias, and select the User ID Search view
*-------------------------------------------------------------
loSelect = CREATEOBJECT("CSelect",This.cView)
*-------------------------------------------------------------
*-- Create a local view parameters for the v_UserIDSearch view
*-------------------------------------------------------------
STORE This.oControl.Value TO (This.cViewParameter)
lcViewParm = (this.cViewParameter2Value)
STORE &lcViewParm TO (This.cViewParameter2)
*---------------------------------------------------
*-- Requery the view to search for the specified ID
*---------------------------------------------------
lnRetVal = REQUERY(This.cView)
*--------------------------------------------
*--- If no records found, the entry is unique
*--------------------------------------------
llUnique = (RECCOUNT(This.cView) = 0)
*---------------------------------
*-- If the entry is not unique ...
*---------------------------------
IF NOT llUnique
*------------------------------------------------------------
*-- Create a context sensitive message to display to the user
*------------------------------------------------------------
IF TYPE('This.oControl.Value') = 'C'
lcSuffix = "'" + ALLTRIM(This.TextBox.Value) + "'"
ELSE
lcSuffix = 'This'
ENDIF
*----------------------
*-- Display the message
*----------------------
=MsgSvc('NotUniqueValue', lcSuffix + '~')
*------------------------------------------*
*--- Restore the field's original value ---*
*------------------------------------------*
This.oControl.Value = This.uOriginalValue
ENDIF
RETURN llUnique