Arsip: help error... lagi

 
user image
more 13 years ago

putukaca

saya ada error pada unit berikut dgn pesan error: "2,600,000' is not a valid floating point value. apanya yg salah ya help donk. error ini terjadi pada saat saya menjalankan event DBLCmb1Change (punyanya rxlib)

unit Unit1;
interface
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, DBCtrls, DB, Grids, DBGrids, MyAccess, MemDS, DBAccess, StdCtrls,
  RxLookup, ExtCtrls;
type
  TForm1 = class(TForm)
    MyConnection1: TMyConnection;
    qJUalls: TMyQuery;
    tbTmp: TMyTable;
    DataSource1: TDataSource;
    DataSource2: TDataSource;
    DBGrid1: TDBGrid;
    tbTmpno: TStringField;
    tbTmpshop: TStringField;
    tbTmpbarcode: TStringField;
    tbTmpkode: TStringField;
    tbTmps1: TSmallintField;
    tbTmps2: TSmallintField;
    tbTmps3: TSmallintField;
    tbTmps4: TSmallintField;
    tbTmps5: TSmallintField;
    tbTmps6: TSmallintField;
    tbTmpttl: TWordField;
    tbTmphrg: TIntegerField;
    tbTmpjml: TIntegerField;
    edPcs: TEdit;
    qEdit: TMyQuery;
    DBLCmb1: TRxDBLookupCombo;
    qTmp: TMyQuery;
    DBNavigator1: TDBNavigator;
    mTotal: TMemo;
    edDisc: TEdit;
    mDisc: TMemo;
    mGrand: TMemo;
    procedure mTotalChange(Sender: TObject);
    procedure DBLCmb1Change(Sender: TObject);
    procedure FormShow(Sender: TObject);
    procedure tbTmpAfterDelete(DataSet: TDataSet);
  private
    { Private declarations }
  public
    { Public declarations }
  end;
var
  Form1: TForm1;
implementation
{$R .dfm}
procedure TForm1.mTotalChange(Sender: TObject);
Var TDisc, TGrand: single;
begin
  TDisc:= strtofloat(mTotal.Text)   (strtofloat(edDisc.Text)/100) ;
  TGrand:= strtofloat(mTotal.Text) - Tdisc;
  mdisc.Text:= floattostr(TDisc);
  mGrand.Text:= floattostr(TGrand);
end;
procedure TForm1.DBLCmb1Change(Sender: TObject);
var s,a: string;
begin
  s:= 'Insert into tmp (no,shop,barcode, kode, s1, s2, s3, s4, s5, s6,ttl,hrg,jml,user,ket)'
  +'SELECT no,shop,barcode, kode, s1, s2, s3, s4, s5, s6,ttl,hrg,jml,user,ket from jualls WHERE no=:pNo';
  qTmp.Close;
  qTmp.SQL.Clear;
  qTmp.SQL.Add(s);
  qTmp.ParamByName('pNo').AsString:= DBLCmb1.Text;
  qTmp.Execute;
  tbTmp.Refresh;
  if (tbTmp.Locate('no',DBLCmb1.Text,)) then
  begin
    s:='select tmp.no,customer.disc,jual.jml,jual.qty'
  	   +' from tmp, customer, jual where tmp.shop=customer.shop'
       +' and tmp.no =:pNo group by tmp.no';
    qEdit.Close;
    qEdit.SQL.Clear;
    qEdit.SQL.Add(s);
    qEdit.ParamByName('pNo').AsString:= DBLCmb1.Text;
    qEdit.Open;
    if qEdit.RecordCount>0 then
    begin
      edDisc.Text:= qEdit.FieldValues['disc'];
      edPcs.Text:= qEdit.fieldByName('qty').AsString;
      mTotal.Text:= formatfloat('#,##0',qEdit.FieldValues['jml']);  --> disini letak errornya
    end;
  end;
end;
procedure TForm1.FormShow(Sender: TObject);
begin
  tbTmp.First;
  while not tbTmp.Eof do
  begin
    tbTmp.EmptyTable;
  end;
end;
procedure TForm1.tbTmpAfterDelete(DataSet: TDataSet);
var TJumlah, TTotal: integer;
begin
  tJumlah:= 0;
  tTotal:= 0;
  tbTmp.First;
    while not tbTmp.Eof do
      begin
        TJumlah:= TJumlah +  (tbTmpttl.Value * tbTmphrg.Value);
        TTotal:= TTotal + tbTmpttl.Value;;
        tbTmp.Next;
      end;
    mTotal.Text:= FormatFloat('###,###,##0',TJumlah);
    edPcs.Text:= inttostr(TTotal);
    tbTmp.Refresh;
end;
end.
user image
more 13 years ago

ZeAL

tipe data field jml itu apa? erornya itu gara2 ada tanda komanya.. coba hilangkan tanda komanya...
user image
more 13 years ago

putukaca

type data field jml adalah integer. saya mau menampilkan data yg didapat dengan pemisah ribuan ke Tmemo(mTotal). ada saran lain mungkin
user image
more 13 years ago

ZeAL

nebak neh.. nebak... hehehe... kalo, qEdit.FieldValues['jml'].AsInteger ...???
user image
more 13 years ago

juan81

aku heran koq atasnya pake edPcs.Text:= qEdit.fieldByName('qty').AsString; sekalian aja bawahnya mTotal.Text:= formatfloat('#,##0',qEdit.fieldByName('qty').AsInteger); hehehehehehe
more ...
  • Pages:
  • 1
Share to

Random Topic

Local Business Directory, Search Engine Submission & SEO Tools FreeWebSubmission.com SonicRun.com