>I seem to be having a new issue with one of my applications.
>
>An error is being returned, Update Conflict zgetmaxitem line 4 data source inspdata.
>
>inspdata is a table in a database that is part of a form's DE. Shared, not exclusive.
>
>The zgetmaxitem is a procedure I have defined in the form.
>
>as follows;
>
>
>IF !EOF('inspdata') AND !BOF('inspdata')
> LOCAL lnRecNo
> lnRecNo=RECNO('inspdata')
> CALCULATE MAX(inspdata.itemnum) FOR inspdata.jobnum==(inspheader.jobnum) TO lnMaxItem
> IF lnRecNo>0
> GO lnRecNo IN 'inspdata'
> endif
> RETURN lnMaxItem
>ELSE
> RETURN 0
>endif
>
Try
LOCAL lnRecNo, lcJobNo, lnOldSelect
lcJobNo = InspHeader.JobNum
lnRecNo=RECNO('inspdata')
lnOldSelect = select()
select InspData
CALCULATE MAX(ItemNum) FOR jobnum==m.lcJobNo TO lnMaxItem
lnMaxItem = NVL(m.lnMaxItem,0)
if lnRecNo > 0
goto m.lnRecNo in InspData
endif
select (m.lnOldSelect)
In other words, try using a variable for JobNo from related table.
In addition, can you show the UPDATE command? What is the purpose of the procedure - if it's to generate next ItemNum per JobNum, this procedure may not guarantee 100% uniqueness.
If it's not broken, fix it until it is.
My Blog