Hey guys i have an application where i assign values to the type of sale it would be -- here's my code --

procedure TPaymentForm.OkButtonClick(Sender: TObject);
begin
      //ID 1 - Cash Sale
       IF (CashRadioButton.Checked) Then

          BEGIN //Opening Data Source and Stuff, Setting The Columns and Stuff
              Data.Statement_Entries_Table.Append;
              Data.Statement_Entries_Table.FieldByName('customer_id').AsInteger;
              Data.Statement_Entries_Table.FieldByName('date_time').AsDateTime := Now;
              Data.Statement_Entries_Table.FieldByName('description').AsString;
              Data.Statement_Entries_Table.FieldByName('amnount').AsCurrency := TxtAmount.Value;
              Data.Statement_Entries_Table.FieldByName('entrytype').AsInteger := 1;
              Data.Statement_Entries_Table.FieldByName('entry_ref').AsInteger;
              Data.Statement_Entries_Table.Post;
          END;

      //ID 2 - Cedit Sale
      IF (CreditRadioButton.Checked) Then

          BEGIN //Opening Data Source and Stuff, Setting The Columns and Stuff
              Data.Statement_Entries_Table.Append;
              Data.Statement_Entries_Table.FieldByName('customer_id').AsInteger;
              Data.Statement_Entries_Table.FieldByName('date_time').AsDateTime := Now;
              Data.Statement_Entries_Table.FieldByName('description').AsString;
              Data.Statement_Entries_Table.FieldByName('amnount').AsCurrency := TxtAmount.Value;
              Data.Statement_Entries_Table.FieldByName('entrytype').AsInteger := 2;
              Data.Statement_Entries_Table.FieldByName('entry_ref').AsInteger;
              Data.Statement_Entries_Table.Post;
          END;

      //ID 3 - Internetsale
      IF (InetrnetTransferRadioButton.Checked) Then

          BEGIN //Opening Data Source and Stuff, Setting The Columns and Stuff
              Data.Statement_Entries_Table.Append;
              Data.Statement_Entries_Table.FieldByName('customer_id').AsInteger;
              Data.Statement_Entries_Table.FieldByName('date_time').AsDateTime := Now;
              Data.Statement_Entries_Table.FieldByName('description').AsString;
              Data.Statement_Entries_Table.FieldByName('amnount').AsCurrency := TxtAmount.Value;
              Data.Statement_Entries_Table.FieldByName('entrytype').AsInteger := 3;
              Data.Statement_Entries_Table.FieldByName('entry_ref').AsInteger;
              Data.Statement_Entries_Table.Post;
          END;

      //ID 4 - Cheque sale
      IF (ChequeRadioButton.Checked) Then

          BEGIN //Opening Data Source and Stuff, Setting The Columns and Stuff
              Data.Statement_Entries_Table.Append;
              Data.Statement_Entries_Table.FieldByName('customer_id').AsInteger;
              Data.Statement_Entries_Table.FieldByName('date_time').AsDateTime := Now;
              Data.Statement_Entries_Table.FieldByName('description').AsString;
              Data.Statement_Entries_Table.FieldByName('amnount').AsCurrency := TxtAmount.Value;
              Data.Statement_Entries_Table.FieldByName('entrytype').AsInteger := 4;
              Data.Statement_Entries_Table.FieldByName('entry_ref').AsInteger;
              Data.Statement_Entries_Table.Post;
          END;

          CashRadioButton.Checked := False;
          CreditRadioButton.Checked := False;
          InetrnetTransferRadioButton.Checked := False;
          ChequeRadioButton.Checked := False;
          TxtAmount.Text := '';
          Close;

end;

I have a text box for entering an amount into the data, and 4 radio butttons or option buttons whatever for choosing an option of payment...

Every time i click on the ok button the entry is stored in the first row of the Datatable and overrides the original one....

i am using MS Office access as database...

Please help...

A couple of questions come to mind:

Are you having this problem in design mode or at run time?
Have you opened your dataset?
Have you correctly set the current record to the one you want?

I am currently writing my first Delphi Database program but am having some other problems (see post re: problems with browsing path) so I cannot t4est what I have written against your problem yet, but I am very interested iun what your outcome is with this issue.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.