tobenschain 0 Posted yesterday at 12:35 PM 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 88 Posted yesterday at 01:40 PM (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 yesterday at 01:44 PM by Die Holländer Share this post Link to post