insert into ... values - a new record and modify the first record of the table

R

rejeanroy

I'm having a problem with an insert into statement base on a button
click.

I have a form that is used to enter energy monthly rates. I design the
form base on the fields of the rate table. For assistance, on the form
load, i fill the fields with the last month values. Values that have
change are overwritten by the user and I use a button to validate the
new values with this bit of code.

DoCmd.SetWarnings False

SQL = "INSERT INTO tblTarifGaz (DateApplic, NomTarif, PrixGaz,
PrixComp, PrixRedevance, PrixAjustement, "
SQL = SQL + "PrixTransport, PrixEquilibre, PrixDist1, Poids1,
PrixDist2, Poids2, PrixDist3, Poids3, "
SQL = SQL + "PrixDist4, Poids4, PrixDist5, Poids5, PrixDist6,
Poids6, PrixDist7, Poids7, PrixDist8, Poids8, "
SQL = SQL + "PrixDist9, Poids9, Facteur) "
SQL = SQL + "VALUES (DTPicker1, NomTarif1, PrixGaz1, PrixComp1,
PrixRedevance1, PrixAjustement1, "
SQL = SQL + "PrixTransport1, PrixEquilibrage, PrixDist11, Poids11,
PrixDist21, Poids21, PrixDist31, Poids31, "
SQL = SQL + "PrixDist41, Poids41, PrixDist51, Poids51, PrixDist61,
Poids61, PrixDist71, Poids71, PrixDist81, Poids81, "
SQL = SQL + "PrixDist91, Poids91, Facteur1)"
DoCmd.RunSQL SQL


DoCmd.SetWarnings True

When I go back to the rate table I see the new record according to the
new values entered BUT the First record of the table has also took the
same values.

Any help on this?

Thanks

Reggie
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top