Recent

Author Topic: [SOLVED] Error: Identifier not found "TFloatField"  (Read 176 times)

fmc

  • New Member
  • *
  • Posts: 27
[SOLVED] Error: Identifier not found "TFloatField"
« on: October 18, 2019, 09:31:35 pm »
I have 2 forms.

On main form, this code work
Code: Pascal  [Select]
  1. procedure TForm_Main.SetAddItemsGridFloats;
  2. begin
  3.   TFloatField(ZQuery_AddItems.FieldByName('inventory_cost')).DisplayFormat := '####0.00';
  4.   TFloatField(ZQuery_AddItems.FieldByName('inventory_sell_price')).DisplayFormat := '####0.00';
  5.   TFloatField(ZQuery_AddItems.FieldByName('inventory_margin_contribution')).DisplayFormat := '####0.00';
  6.   TFloatField(ZQuery_AddItems.FieldByName('inventory_weight')).DisplayFormat := '####0.00';
  7.   TFloatField(ZQuery_AddItems.FieldByName('inventory_in_stock')).DisplayFormat := '####0.00';
  8. end;
On other form, this code not work
Code: Pascal  [Select]
  1. procedure TForm_CreateNewBOM.SetInventoryGridFloats;
  2. begin
  3.   TFloatField(Form_Main.ZQuery_InventoryForBOM.FieldByName('inventory_cost')).DisplayFormat := '####0.00';
  4.   TFloatField(Form_Main.ZQuery_InventoryForBOM.FieldByName('inventory_sell_price')).DisplayFormat := '####0.00';
  5.   TFloatField(Form_Main.ZQuery_InventoryForBOM.FieldByName('inventory_margin_contribution')).DisplayFormat := '####0.00';
  6.   TFloatField(Form_Main.ZQuery_InventoryForBOM.FieldByName('inventory_weight')).DisplayFormat := '####0.00';
  7.   TFloatField(Form_Main.ZQuery_InventoryForBOM.FieldByName('inventory_in_stock')).DisplayFormat := '####0.00';
  8. end;

I get errors. Why TFloatField work for one form and not other?
« Last Edit: October 18, 2019, 09:56:51 pm by fmc »
Win X Pro / Lazarus 2.0.6 / FPC 3.0.4

korba812

  • Full Member
  • ***
  • Posts: 106
Re: Error: Identifier not found "TFloatField"
« Reply #1 on: October 18, 2019, 09:36:00 pm »
You need to add 'DB' unit in the 'uses' section:
Code: Pascal  [Select]
  1. uses
  2.   db, ...
  3.  

fmc

  • New Member
  • *
  • Posts: 27
Re: Error: Identifier not found "TFloatField"
« Reply #2 on: October 18, 2019, 09:50:49 pm »
Thank you korba812. That did fix.
Win X Pro / Lazarus 2.0.6 / FPC 3.0.4