Edit Works, ADD gives a bug??

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
heerdinm
Posts: 14
Joined: Fri 14 Dec 2012 11:35

Edit Works, ADD gives a bug??

Post by heerdinm » Sun 27 Jan 2013 19:40

I have a piece of code where the EDIT option works just fine.
If i do the same piece of code with ADD, i get an error message.
I have a very simple select statement.... Select * From CuratorBenoeming

I use code which i have used for more then 5 years without problems.
When i want to add a record with this code, i get the message:

[Microsoft][ODBC Microsoft Access-stuurprogramma]
De instructie INSERT TO bevat een syntaxfout (The instruction INSERT TO contains a syntax error)

The same code with EDIT works fine.
I tried this out with adding a record to the table and try to edit this. No problem.
Same code with ADD, problem as stated above.

The code is as follows:

Code: Select all

    tblAdd := FQry;
    with tblAdd do begin
      if not tblAdd.Active then
        tblAdd.Open;

      if FormMode = MODE_ADD then
        Append
      else
        Edit;

      SaveFieldsToDataSet;
      try
        Post;
        OnderhoudPostSave( tblAdd.FieldByName('ID').AsInteger );
      except
        On E: Exception do
          SKAMessageOk(E.Message);
      end;
    end;


procedure TfrmCuratorBenoemingEdit.SaveFieldsToDataSet;
begin
  FormQRY.FieldByName(CB_CURATOR_ID).AsInteger           := curatorID;
  FormQRY.FieldByName(CB_DATUM_BENOEMING).AsString       := edtDatum.Text;
  FormQRY.FieldByname(CB_BENOEMING_NAAM).AsString        := edtOmschrijving.Text;
  FormQRY.FieldByName(CB_FAILLISSEMENTS_NUMMER).AsString := edtFaillNummer.Text;
  FormQRY.FieldByName(CB_SALARIS_BEDRAG).AsString        := edtBedrag.Text;
  FormQRY.FieldByName(CB_AFDOENING).AsString             := edtAfdoening.Text;
  FormQRY.FieldByName(CB_OPMERKING).AsString             := memoOpmerking.Text;
end;
i disabled every row of code in the last procedure to see what would give me a correct piece of code. It does not matter which line i comment, the error keeps persisting.

I have another table and added a record there. No problem. Only with this table i have a problem.

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: Edit Works, ADD gives a bug??

Post by AlexP » Mon 28 Jan 2013 10:34

Hello,

Please provide the script for creating the table or send the DB file to alexp*devart*com, in order we can reproduce the problem, and specify your versions of UniDAC, MS Access and IDE.

Post Reply