DMax doesn't find correct record

D

David

Hello,

Had an existing table with a alphanumeric primary key. Used to use it one
way but decided to just use a padded number string now. So have the code:

custkey = Format(CLng(DMax("[CustomerID]", "CustomerMaster")) + 1,
"000000000")

Which has worked fine. I then setup a brief case to take the db with me
and it needed to enable replication on all the objects in the database. Now
when it runs the above for multiple items being imported it finds the key
before last. In other words, if the max value started as 1 then it would
..addnew for a key of 2 then .update that record then when the next item to
import came along it would find 1 again instead of 2 ... when the .update
fails (dup key) then I can move the pointer back up to the statement above
and this time it does find it as 2 so adds the record as 3 but then bombs on
the next.

Is there something I must do to make it work when replication is enabled?
Requery or a 10millisecond delay or something???
 

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