From: Stephen Quinn on 23 Apr 2010 04:05 Mario > IF cWie == "NEU" // Your not checking for success - you only get a lock if successful // IF oKopf:Append() oKopf:Append() // What's the code in x_NewNumber() look like?? // Does it move the current record pointer?? cBeleg := x_NewNumber("","A") //StrZero(NewNumber("AUFTRAG"),6) oKopf:Beleg := cBeleg oKopf:Verlauf := PadR("Anlage am " + DToC(Today()) + " um " + Time() + " PC " + ComputerName() + " / User " + _GetUser(),80) ENDIF // What's this do?? > oKopf:NLOCK() > // Why this here - why not an else statement?? > IF cWie != "NEU" oKopf:Verlauf += CRLF+PadR("�nderung am " + DToC(Today()) + " um " + Time() +"/"+AllTrim(Str(oKopf:Netto))+ " PC " + ComputerName() + " / User " + _GetUser(),80) > ENDIF Where's the COMMIT method call?? Eg oKopf:Commit() // REQUIRED when NOT using CC_Optimistic. /////////////////////////////////////////// Simpler code lOK := FALSE cDT := DToC(Today()) + " um " + Time() cCU := " PC " + ComputerName() + " / User " + _GetUser() IF cWie == "NEU" IF oKopf:Append() lOK := TRUE cBeleg := x_NewNumber("","A") //StrZero(NewNumber("AUFTRAG"),6) oKopf:Beleg := cBeleg cText := PadR( "Anlage am " + cDT + cCU,80) ENDIF ELSE // Assuming you want to write to the current record if it isn't a new one lOK := oKopf:RLock() cNet := AllTrim(Str(oKopf:Netto)) + "/" cText := Trim( oKopf:Verlauf ) + CRLF cText += PadR( "�nderung am " + cDT + cNet + cCU, 80 ) ENDIF IF lOK // Only TRUE when Append() or RLock() is sucessful oKopf:Verlauf := cText oKopf:Commit() ELSE // Message to user about not saving data ENDIF If you don't have a Commit() then that's probably the problem. CYA Steve |