Parameters xEvent llok = .f. Do case case xevent = 1 If !Empty(thisform.grd1.RecordSource) and Used(thisform.grd1.RecordSource) thisFORM.grd1.ActivateCell(1,1) Select (thisform.grd1.RecordSource) Scatter MEMVAR fields codcdc,tipcod,codart lLOk = .t. EndIf With thisform.shape1 Try If !Used('log') Use 'log' Again In 0 Order 'sessione' EndIf .Tag = '' Catch to oErr If oErr.errorno = 1705 .Tag = Alltrim(Str(Val(.Tag) + 1)) .backColor = Rgb(255,0,0) EndIf EndTry Do case Case Val(.Tag) > 2 =scriviLog("last chance to access to File log ") If !Used('log') Use 'log' Again In 0 Order 'sessione' EndIf =scriviLog("File log now accessible ") .Tag = '' Case Val(.Tag) > 0 =scriviLog("File log non accessible, try " + .tag) Return EndCase If Empty(.tag) .backcolor = Rgb(207,224,220) EndIf EndWith If Seek(zSessione,'log','sessione') && that's the line which causes the error Replace oralast with Datetime() in 'log' &&------------------------------------------------ EndIf thisform.LockScreen = .t. If zTipoPc = '1' llenable=TmMain() else llEnable = 1 If !thisform.godateprod(Date()) or ; Datetime() - dateprod.lastagg > 20*(zIntervallo/1000) thisform.BackColor = Rgb(255,128,128) llenable = -1 Else thisform.ResetToDefault('BackColor') EndIf EndIf If Used('log') Use in 'log' EndIf thisform.plsSTP.Enabled = llenable > 0 thisform.container1.Visible = llenable = 0 If llEnable >= 0 thisform.loadcursor() If llOk If !Empty(thisform.grd1.RecordSource) Select (thisform.grd1.RecordSource) Locate for codcdc+tipcod+codart == m.codcdc+m.tipcod + m.codart If !Found() Locate EndIf With thisform.grd1 llrowheight = .rowHeight .rowheight = .height .refresh() .rowheight = llrowheight EndWith EndIf EndIf EndIf If llEnable = -1 thisform.LockScreen = .f. Release thisform Return .f. EndIf thisform.container1.txtgen1.value = ; Iif(thisform.GoDateProd(Date()),Str(dateprod.numbol,2) + ' - ' + Str(dateprod.numord,7),'') thisform.LockScreen = .f. *------------------------------------------------------------------------ case xevent = 2 =TmConsuntivo() EndCasethis procedure occurs every 30 seconds