tobenschain 0 Posted July 15 I'm trying to add a field to an existing file with four fields. BudSys_DB.Active := true; BudSys_DB.FieldDefs.Add('Amount',ftFloat, 0); BudSys_DB.FieldDefs.Count goes up but BudSys_DB.Fields.Count stays at four BudSys_DB.Fields[3+1].AsFloat := amount; Gives: Project BudGen6.exe raised exception class EDatabaseError with message 'List index out of bounds (6).  TFields range is 0..3'.  Share this post Link to post
Die HollĂ€nder 91 Posted July 15 (edited) Try after the add  BudSys_DB.FieldDefs[4].CreateField(BudSys_DB);  or  Private: AmountField : TFloatField;  Implementation:  AmountField := TFloatField.Create(BudSys_DB); AmountField .FieldName := 'Amount'; AmountField .Calculated := True; AmountField .DataSet := BudSys_DB; AmountField .Name := BudSys_DB.Name + AmountField .FieldName; BudSys_DBï»ż.FieldDefs.Add('Amountï»ż',ftFloat, 0);  Destroy: AmountField.Free;  Edited July 15 by Die HollĂ€nder Share this post Link to post