Menu

#66 Field Changed by itself.

Win32_only
open
5
2014-08-15
2009-02-10
Wallace
No

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;

Discussion

  • Micha Nelissen

    Micha Nelissen - 2009-02-10

    Can you attach a complete test project please? This makes it much easier for me to reproduce the issue. Thanks.

     
  • Wallace

    Wallace - 2009-02-11

    Source and database

     
  • Wallace

    Wallace - 2009-02-11

    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

     
  • Wallace

    Wallace - 2009-02-11

    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

     
  • Wallace

    Wallace - 2009-02-14

    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

     

Log in to post a comment.