Edit Works, ADD gives a bug??
Posted: 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:
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.
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 have another table and added a record there. No problem. Only with this table i have a problem.