on autonumber, bookmark and last modified... (1 Viewer)

lcarpay

Registered User.
Local time
Today, 02:25
Joined
Oct 20, 2017
Messages
11
Hi, I recently ran into a strange error with getting an Id from a DAO.Recordset.The back-end is a sql-express 2014 database.
The high level logic being:

  1. make a pdf (access report)
  2. store the path in a table and get the DocId
  3. send out a mail to the party contact with the pdf as attachment
I got the wrong DocId and the wrong attachment was send (ai!).


I used this construct (after rs.AddNew and rs.Update):
rs.Move 0, rs.LastModified
vDocId = rs!Id
and changed it to
rs.Bookmark = rs.LastModified
vDocId = rs!Id
I wonder if there is any functional difference. Thanks
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 18:25
Joined
Oct 29, 2018
Messages
21,358
Hi. Not sure about your question but I use the @@IDENTITY function.
 
Last edited:

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 01:25
Joined
Sep 12, 2006
Messages
15,614
I don't use your methods, but could your result have been affected by other concurrent users?
 

lcarpay

Registered User.
Local time
Today, 02:25
Joined
Oct 20, 2017
Messages
11
Thanks for your answers DBGuy and Gemma but tt was something else.

While away from the screen and walking the dog (which always leads to the solution of the problem at hand ;)), it came to me: the user must have had the report open on screen while, in an another form, the batch creation of the pfd's was kicked-off.
The solution to this so called "strange behavior" in code?
  1. check whether the report is open
  2. if so, close it
  3. run the report with the parameters wanted

Thanks again for taking the time.
 

Users who are viewing this thread

Top Bottom