Results 1 to 3 of 3

Thread: recordset.LastModified does not seem to work

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jun 2006
    Location
    Texas
    Posts
    164

    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

  2. #2
    PowerPoster
    Join Date
    Jul 2006
    Location
    Maldon, Essex. UK
    Posts
    6,334

    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

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jun 2006
    Location
    Texas
    Posts
    164

    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
  •  



Click Here to Expand Forum to Full Width