Subject Re: [IBO] weird posting error
Author james_027
here is the application

hope is might help in solving the problem


here is the dfm of the ib_query
_________________________________________________________
object produce: TIB_Query
ColumnAttributes.Strings = (
'"ItemName"=COMPUTED'
'"ItemID"=REQUIRED'
'"ProduceTime"=REQUIRED'
'"Qty"=REQUIRED'
'"Unit"=REQUIRED'
'"RecordBy"=REQUIRED'
'"ProduceDate"=REQUIRED')
DatabaseName = 'D:\Works\KSK\database\ACCTDB.GDB'
FieldsCharCase.Strings = (
'"RecordBy"=UPPER'
'"Remarks"=UPPER')
FieldsDisplayFormat.Strings = (
'"ProduceDate"=mm/dd/yy'
'"ProduceTime"=hh:mm AM/PM')
FieldsEditMask.Strings = (
'"ProduceTime"=!90:00> LL;1;_')
FieldsIndex.Strings = (
'ID'
'"ItemID"'
'"ProduceDate"'
'"ProduceTime"'
'"ItemName"'
'"Qty"'
'"Unit"'
'"RecordBy"'
'"Remarks"'
'"Status"')
FieldsReadOnly.Strings = (
'"Qty"=NOEDIT'
'"Unit"=NOEDIT'
'"ItemID"=NOEDIT')
FieldsVisible.Strings = (
'"Base"=TRUE')
IB_Connection = Form_main.IB_Connection1
SQL.Strings = (
'select m.*,'

' (select "Name" from "items" d where d.ID = m."ItemID")
as "I' +
'temName",'

' (select "Base" from "items" d2 where d2.ID = m."ItemID")
as ' +
'"Base"'
'from "produce" m'
'where "ProduceDate" >= :paramdate and "Status" !
= :"paramstatus"')
ColorScheme = True
DefaultValues.Strings = (
'"Qty"=0'
'"Status"=ACT')
DeleteSQL.Strings = (
'DELETE FROM "produce"'
'WHERE'
' ID = :OLD_ID')
EditSQL.Strings = (
'UPDATE "produce" SET'
' ID = :ID, /*PK*/'
' "ItemID" = :"ItemID",'
' "ProduceDate" = :"ProduceDate",'
' "ProduceTime" = :"ProduceTime",'
' "Qty" = :"Qty",'
' "Unit" = :"Unit",'
' "RecordBy" = :"RecordBy",'
' "Remarks" = :"Remarks",'
' "Status" = :"Status"'
'WHERE'
' ID = :OLD_ID')
GeneratorLinks.Strings = (
'"produce".ID="gen_produce"')
InsertSQL.Strings = (
'INSERT INTO "produce"('
' ID, /*PK*/'
' "ItemID",'
' "ProduceDate",'
' "ProduceTime",'
' "Qty",'
' "Unit",'
' "RecordBy",'
' "Remarks",'
' "Status")'
'VALUES ('
' :ID,'
' :"ItemID",'
' :"ProduceDate",'
' :"ProduceTime",'
' :"Qty",'
' :"Unit",'
' :"RecordBy",'
' :"Remarks",'
' :"Status")')
KeyLinks.Strings = (
'ID')
MasterSearchFlags = [msfOpenMasterOnOpen,
msfSearchAppliesToMasterOnly]
OrderingItemNo = 2
OrderingItems.Strings = (
'"ItemID"="ItemID";"ItemID" DESC'
'"ProduceDate"="ProduceDate";"ProduceDate" DESC')
OrderingLinks.Strings = (
'"ItemID"=ITEM=1'
'"ProduceDate"=ITEM=2')
SearchingLinks.Strings = (
'"ItemID"="ItemID"'
'"ProduceDate"="ProduceDate"')
BeforeEdit = produceBeforeEdit
BufferSynchroFlags = []
FetchWholeRows = True
Left = 528
Top = 72
end

____________________________________________________

and here is the code for saving each entry that I have made

procedure Tform_produce.btn_saveClick(Sender: TObject);
var
tempdate:tdate;
temptime:ttime;
begin
if produce.State in [dssinsert, dssedit] then
begin
produce.Post;
produce.IB_Transaction.SavePoint;

// WRITIING ON TEMPORARY VARIABLES
tempdate:=produce.fieldbyname('ProduceDate').asDate;
temptime:=produce.fieldbyname('ProduceTime').asDateTime;

produce.Append;
produce.fieldbyname('ProduceDate').asDate:=tempdate;
produce.fieldbyname('ProduceTime').asDateTime:=temptime;
IB_Date1.SetFocus;

end
else
begin
produce.Append;
produce.fieldbyname('ProduceDate').asDate:=tempdate;
produce.fieldbyname('ProduceTime').asDateTime:=temptime;
IB_Date1.SetFocus;
end;
end;


______________________________________________________-

I have same kind of procedure in my other form where I haven't
encounter the unknown problem that I have here.

Helen had suggested to avoid the savepoint and use commitretainning.
but my problem is I have other dataset that are in edit state and
aren't ready to post yet.