|
-
May 17th, 2013, 01:10 PM
#1
Thread Starter
Addicted Member
recordset.LastModified does not seem to work
I have a routine that creates a log entry into a table (that has already been created, is Global and never closed while program running) as certain things are done. I call the following routine before the user starts the particular function so as to create the log entry, then at the end of that particular function, I call the routine and want to add to the previous log entry the words " and finished" that way the log keeps up with the functions starting AND finishing. However, when I try to use the LastModified it always takes me to the first record, not the last added. I know I can use the MoveLast, but it may not be the last entry due to user back dating a system, etc. I even tried capturing the bookmark at the time I create the initial record then trying to return to it but it still takes me to the first record.
Sub CreateLogEntry(Description)
If Description = " and finished." Then
LogRSTable.LastModified
' LogRSTable.Bookmark = ThisBokMrk This does not seem to work either
LogRSTable.Edit
LogRSTable("Action") = LogRSTable("Action") & Description
LogRSTable.Update
Else
LogRSTable.AddNew
LogRSTable("Action") = Left$(Format$(Date, "yyyy/mm/dd") & " " & Format(Time, "hh:mm:ss AM/PM") & " " & Description & " by " & UserName$, 150)
LogRSTable.Update
ThisBokMrk = LogRSTable.Bookmark
End If
End Sub
-
May 18th, 2013, 12:51 AM
#2
Re: recordset.LastModified does not seem to work
Found this, which might help
When you add a record to a Recordset, you might expect that record to become the current record. If that’s your expectation, your code will fail to return the expected results because that is not what happens. If you want to work with the new record, you must force the newly added record to become the current record by setting a bookmark immediately after the Update method as follows:
rst.Update
rst.Bookmark = rst.LastModified
-
May 18th, 2013, 07:08 AM
#3
Thread Starter
Addicted Member
Re: recordset.LastModified does not seem to work
Learned something new. Hey, thanks a lot. I'll try that first thing Monday and report back.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|