Go Back   Access World Forums > Microsoft Access Discussion > Modules & VBA

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 06-15-2019, 02:08 AM   #1
lcarpay
Newly Registered User
Gold Supporter
 
Join Date: Oct 2017
Location: The Netherlands (Wijhe)
Posts: 10
Thanks: 5
Thanked 0 Times in 0 Posts
lcarpay is on a distinguished road
on autonumber, bookmark and last modified...

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

lcarpay is offline   Reply With Quote
Old 06-15-2019, 04:22 AM   #2
theDBguy
Iím here to help
 
theDBguy's Avatar
 
Join Date: Oct 2018
Location: SunnySandyEggo
Posts: 3,063
Thanks: 36
Thanked 730 Times in 713 Posts
theDBguy will become famous soon enough theDBguy will become famous soon enough
Re: on autonumber, bookmark and last modified...

Hi. Not sure about your question but I use the @@IDENTITY function.
__________________
Just my 2 cents...

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

Last edited by theDBguy; 06-15-2019 at 06:52 AM.
theDBguy is offline   Reply With Quote
The Following User Says Thank You to theDBguy For This Useful Post:
lcarpay (06-15-2019)
Old 06-15-2019, 01:44 PM   #3
gemma-the-husky
Super Moderator
 
gemma-the-husky's Avatar
 
Join Date: Sep 2006
Location: UK
Posts: 13,767
Thanks: 55
Thanked 1,022 Times in 988 Posts
gemma-the-husky is a name known to all gemma-the-husky is a name known to all gemma-the-husky is a name known to all gemma-the-husky is a name known to all gemma-the-husky is a name known to all gemma-the-husky is a name known to all
Re: on autonumber, bookmark and last modified...

I don't use your methods, but could your result have been affected by other concurrent users?

__________________
Dave (Male!)
Gemma was my dog

if a poster helps you, please click the scales at the bottom left of this posting, or use the thanks button alongside.
gemma-the-husky is offline   Reply With Quote
The Following User Says Thank You to gemma-the-husky For This Useful Post:
lcarpay (06-15-2019)
Old 06-15-2019, 07:52 PM   #4
lcarpay
Newly Registered User
Gold Supporter
 
Join Date: Oct 2017
Location: The Netherlands (Wijhe)
Posts: 10
Thanks: 5
Thanked 0 Times in 0 Posts
lcarpay is on a distinguished road
Re: on autonumber, bookmark and last modified...

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.

lcarpay is offline   Reply With Quote
Reply

Tags
vba sql bookmark

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Last Modified Date ONLY if record is modified Snowflake68 Forms 8 02-05-2018 01:28 AM
Modified AutoNumber in Query affects Printing of Report rmrufe Reports 13 01-03-2018 06:35 PM
me.bookmark the_net_2.0 Modules & VBA 4 12-26-2010 05:55 AM
Bookmark for recordsets object not co-ordinating with bookmark of the form AshikHusein Modules & VBA 3 08-19-2004 07:35 AM
[SOLVED] bookmark amin islam General 0 07-22-2003 07:41 AM




All times are GMT -8. The time now is 04:36 PM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Featured Forum post


Sponsored Links


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World