increment of field after insert working poorly

B

bicyclops

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.
 
R

Rick Brandt

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.
 

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