In the lostfocus method of textboxes, comboboxes and editbox i have code as down below.
This code resets the fieldstatus if no real change was made during editting record-data.
This works fine in my develop-environment but when running the executable an error pops up saying that that this function requires buffered data.
I am using optimistic rowbuffering.
And to make it more weird. One machine throws this error but another don't.
Any idea?
-Bart
This code resets the fieldstatus if no real change was made during editting record-data.
This works fine in my develop-environment but when running the executable an error pops up saying that that this function requires buffered data.
I am using optimistic rowbuffering.
And to make it more weird. One machine throws this error but another don't.
Any idea?
-Bart
Code:
LPARAMETERS tForm, tObject
LOCAL lcAlias, lcType, lnBufferMode, lnFieldState, lNewRecord, lcOldValue
lcAlias = ""
lcType = ""
lnBufferMode = 0
lnFieldState = 0
lNeRewcord = .F.
lcOldValue = ""
WITH tObject
IF VARTYPE(tForm)="O"
IF PEMSTATUS(tForm,'lNewRecord',5)
lNewRecord = tForm.lNewRecord
ENDIF
ENDIF
IF !EMPTY(.ControlSource) AND ! 'THISFORM' $ UPPER(.ControlSource)
** voorloopspaties verwijderen
IF TYPE( .ControlSource )=="C"
.Value = ALLTRIM(.Value)
ENDIF
IF '.' $(.ControlSource)
lcAlias = JUSTSTEM(.ControlSource)
ENDIF
lcFieldName = JUSTEXT(.ControlSource)
IF !EMPTY(lcAlias)
lnSelect = SELECT()
SELECT (lcAlias)
lnBuffermode = CURSORGETPROP("Buffering")
lnFieldState = GETFLDSTATE(lcFieldName,lcAlias)
SELECT (lnSelect)
ELSE
lnBuffermode = CURSORGETPROP("Buffering",lcAlias)
lnFieldState = GETFLDSTATE(lcFieldName)
ENDIF
IF lnBuffermode > 1
*************
* here the error is triggered
*************
lcOldValue = OLDVAL(lcFieldName)
ENDIF
DO CASE
CASE lnBufferMode > 1 AND !lNewRecord AND !EMPTY(lcAlias) AND (lcOldValue = .Value) AND (lnFieldstate = 2 OR lnFieldstate = 4)
SETFLDSTATE(lcFieldName,ICASE(lnFieldState=4,3,lnFieldState=2,1),lcAlias)
CASE lnBufferMode > 1 AND !lNewRecord AND EMPTY(lcAlias) AND (lcOldValue = .Value) AND (lnFieldstate = 2 OR lnFieldstate = 4)
SETFLDSTATE(lcFieldName,ICASE(lnFieldState=4,3,lnFieldState=2,1))
ENDCASE
ENDIF
ENDWITH
RETURN