increment of field after insert working poorly

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Access 03

I have a sales quote form with line item numbers. I have a macro that
increments the item number (using dcount) when a new item is added. It's tied
to the After Insert event of the form.

When the macro runs, it leaves the record unsaved when it's done. If I
attempt to add a SaveRecord line, an error results that tells me I can't use
the BeforeUpdate event (which is maddening, because I'm not using it).

I don't like leaving the record unsaved, because the user my click the save
record button twice.
 
bicyclops said:
Access 03

I have a sales quote form with line item numbers. I have a macro that
increments the item number (using dcount) when a new item is added.
It's tied to the After Insert event of the form.

When the macro runs, it leaves the record unsaved when it's done. If I
attempt to add a SaveRecord line, an error results that tells me I
can't use the BeforeUpdate event (which is maddening, because I'm not
using it).

I don't like leaving the record unsaved, because the user my click
the save record button twice.

Use BeforeInsert, not AfterInsert. When you change the record AFTER you
have inserted it then you are re-dirtying it.
 
Back
Top