I have two tables. The first references the second as a list of valid selection options. When I double click table 1, the field name in 1 over writes the field name in 2 and is which ever record the second table is set to.
If a valid record is not found, I can overcome this by going to the last record and next.
I found the original problem using lookup tables, so I wrote a manual lookup and found the same problem.
// dbeToolSel6 contains tblOper.Lab1
procedure TfToolOffset.dbeToolSel6DblClick(Sender: TObject);
begin
with dm.tblTool do begin // Table 2
if Locate('ToolNo','6',[]) then begin
edit;
FieldByName('ToolNo').asString:='';
post;
end;
else begin
last; // If I don't do this
next; // tbl1('Lab1') is copied into tblTool('Desc')
end;
fToolLib.showModal; // this open a dbGrid and I select a record.
edit; dm.tblOper.FieldByName('VAL16').asstring:=dm.tblTool.FieldByName('Measured').asString;
dm.tblOper.FieldByName('VAL17').asstring:=dm.tblTool.FieldByName('Actual').asString;
dm.tblOper.FieldByName('VAL18').asstring:=dm.tblTool.FieldByName('ZVal').asString;
post;
end;
end;
end;
Can you attach a complete test project please? This makes it much easier for me to reproduce the issue. Thanks.
Source and database
This is really frustrating me. I must have manually corrected the Tool Library 20 + times and I cannot reproduce a consistent set of key strokes to create the fault. Record 1 get overwritten with other record's data.
I'm new to Windows programming so the program has to be run in C:\ConvCNC. I'm using Delphi 4.3. I have tried several options of code and all produce the 'fault'. I had exactly the same error with dbLookUpBox
To run the program, click Tool Offset. The CNC machine has 6 tools. In double clicking the tool description, the tool is deselected in the library and the old offsets are saved. Highlighting a new tool and Update, loads new values into the Tool Offsets and every now and then record 1 gets over writen.
Thanks Wallace
File Added: ConvCNC.zip
This is really frustrating me. I must have manually corrected the Tool Library 20 + times and I cannot reproduce a consistent set of key strokes to create the fault. Record 1 get overwritten with other record's data.
I'm new to Windows programming so the program has to be run in C:\ConvCNC. I'm using Delphi 4.3. I have tried several options of code and all produce the 'fault'. I had exactly the same error with dbLookUpBox
To run the program, click Tool Offset. The CNC machine has 6 tools. In double clicking the tool description, the tool is deselected in the library and the old offsets are saved. Highlighting a new tool and Update, loads new values into the Tool Offsets and every now and then record 1 gets over writen.
Thanks Wallace
File Added: ConvCNC.zip
I am running Delphi 4 with SP3
When I added TDBF I got the following message
[Warning] Dbf.pas(305): Method 'SetFieldData' hides virtual method of base type 'TDataSet'
[Error] Dbf.pas(443): Property 'BeforeRefresh' does not exist in base class
[Error] Dbf.pas(444): Property 'AfterRefresh' does not exist in base class
[Fatal Error] Dbf.pas(13): Could not compile used unit 'dbf'
I commented these two items out. Could this contribute the the problem I found ?
I also get when installing
[Warning] Dbf.pas(305): Method 'SetFieldData' hides virtual method of base type 'TDataSet'
[Hint] Package 'tdbf_d4' does not use or export 'Dbf_Collate._BLLT1DA0'
[Hint] Package 'tdbf_d4' does not use or export 'Dbf_Collate.BLLT1DA0'
[Hint] Package 'tdbf_d4' does not use or export 'Dbf_Collate._BLLT1NL0'
[Hint] Package 'tdbf_d4' does not use or export 'Dbf_Collate.BLLT1NL0'
[Hint] Package 'tdbf_d4' does not use or export 'Dbf_Collate.BLLT1CA0'
[Hint] Package 'tdbf_d4' does not use or export 'Dbf_Collate.BLLT1IT0
Etc
Thanks Wallace