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 90 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