Please help with incrementing field

G

Guest

I am using the following code to increment the ID field by one:
Dim v_Max As String
v_Max = Format(DMax("ID", "tblkpGendertst") + 1, "000")
Me.ID = v_Max
the code is in the ID after update event. The code works if the user is
entering the data manually one at the time. However, when the user pastes
multiple records on the form, which is a datasheet view, the code assigns the
same ID without incrementing. I need help! how can I have the code increment
in the scenario of copy and paste. It is important to give the user the
capability to copy and paste. please help.
thanks
Al
 
G

Guest

You could set the ID field in tblkpGendertst to be an autonumber instead of
just a plain number. That way every record added to the table gets an
incremental value no matter how they are added.

TomU
 

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