>>In further inspection, the Status property does get populated in this circumstance. This property should return 11 (adFieldSchemaViolation) for the offending field object.
>>
>>Can you post more details as to how you are checking the status field?
>
>I mean status property.
Hi Again,
Here is some sample code. The problem lies in the HandleConstraint Function and is highlighted in
red bold :
Thanks for your help.
Regards,
Gerry
#DEFINE adfilterconflictingrecords 5
ON ERROR erroradohandler(orecordset)
oconnection = CREATEOBJECT("ADODB.Connection")
oconnection.errors.CLEAR
orecordset = CREATEOBJECT("ADODB.Recordset")
oconnection.OPEN("Provider=SQLOLEDB;Server=GerryDeskTop;Database=FocusTest;User Id=SA;Password=;")
WITH orecordset
.activeconnection = oconnection
.locktype = 4
.OPEN("customer")
.addnew
.FIELDS(0).VALUE=1111
.FIELDS(1).VALUE=" "
.updatebatch(3)
ENDWITH
FUNCTION erroradohandler(lorecordset)
LOCAL lnerrornumber
WITH lorecordset.activeconnection.errors
IF .COUNT > 0
FOR lcnt = 1 TO .COUNT
lnerrornumber = .ITEM(lcnt).NUMBER
DO CASE
CASE lnerrornumber = -2147217873
IF handleconstraint(lorecordset)
RETURN .T.
ELSE
RETURN .F.
ENDIF
OTHERWISE
WAIT WINDOW "Unknown Error"
ENDCASE
ENDFOR
ENDIF
ENDWITH
ENDFUNC
FUNCTION handleconstraint(lorecordset)
LOCAL lnrecordcount lcoldfilter lorecord
WITH lorecordset
lcoldfilter = .FILTER
.FILTER = adfilterconflictingrecords
lnrecordcount = .recordcount
IF lnrecordcount > 0
IF !.BOF .movefirst
ENDIF
DO WHILE !.EOF
FOR lncnt = 1 TO .FIELDS.COUNT
lnstatuscode = .FIELDS(lncnt-1).STATUS
ENDFOR
.movenext
ENDDO
ENDIF
ENDWITH
ENDFUNC