delphi4arab منتديات دلفي للعرب

نسخة كاملة : تصحيح الكوذ من فضلكم
أنت حالياً تتصفح نسخة خفيفة من المنتدى . مشاهدة نسخة كاملة مع جميع الأشكال الجمالية .
PHP كود :
procedure TForm1.Button1Click(Sender: TObject);
var
  mStr,ComparVal: string;
  begin
  TableAbbreviations
.First;
  while not TableAbbreviations.Eof do
  begin

        ComparVal 
:= TableAbbreviations.FieldByName('ID').AsString;
        mStr := TableAbbreviations.FieldByName('Abbrev').AsString;
    if  TableAchat.Locate('ID_Abbrev',  ComparVal, []) then
    begin
        sEdit68
.Text:=  Copy(mStr, 1,Length(mStr))+'_' +Format('%0.4d',[ TableAchat.RecordCount+1]);
        Tableproduit.Insert;
        Tableproduit.FieldByName('Code_produit').AsString := sEdit68.Text;
        Tableproduit.Post;
     end ;
         TableAbbreviations.Next;
    end;
  end;

end. 



حدول التسميات كل مرة ياخذ التسمية من الجدول ويضيف لها الرقم التسلسلي في الجداول الاخرى ليصبح كالتالي
CL_0001 client
PR_0001 produit

اريد في كل مرة يبحث في الجدول ويضيف في الجدول الخاص اذا كان خاص بالشراء AC_0001
اذا كانت عملية اضافة منتوج في جدول المنتوجات PR_0001
استعمل الدالة
Locate , vararrayof