Results 1 to 6 of 6
  1. #1
    warrenpage is offline Advanced Beginner
    Windows 8 Access 2013
    Join Date
    Oct 2013
    Posts
    69

    How Do I Create a Go To Last Modified/Updated Record Command Button?

    Here's my question for the day.

    I want to put a command button on my form that goes to the last modified or updated record. (I don't want to do this on load.)

    I've read a little bit about this but it's a bit over my head. I haven't dealt with DAO or record sets yet. And everything I've read has samples of VBA code.

    http://msdn.microsoft.com/en-us/libr.../ff195859.aspx



    Can this be done without VBA? (I'm just a notch above a database novice.) Is there a simpler way of doing this? Do I need a timestamp field? I have one, but it doesn't work for records imported into tables from Excel. (At least, I don't know how to get that feature to work--I can only get it to work on newly entered records.)

    Would anyone be able to point me to a tutorial that would demonstrate how to do this? Thank you. WP

  2. #2
    naeemahmad is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Nov 2013
    Location
    Riverside, USA
    Posts
    46
    Hi. I have used the bookmark to navigate back to the previous or 'Last modified/updated' record. the process is quite simple using a recordsetclone and bookmark property.

    Bookmarks are not saved with the records they represent and are only valid while the form is open.
    They are re-created by Microsoft Access each time a bound form is opened and there is no limit to the number of bookmarks you can save if each is saved with a unique string variable.
    The bookmark property is only available for the form's current record.

    You can use bookmarks in any form that is based entirely on Microsoft Access tables.
    but you can't use bookmarks in a form based on a linked table that has no primary index.

    Below is code I have used in the past reliably from a command button.

    '------------------------------------------------------------------
    Private Sub Command63_Click()

    Dim rs As Object
    Dim lngBookmark As Long

    On Error GoTo Err_Command63_Click
    'set a variable to the current record
    lngBookmark = Me.Text61
    'requery the form
    Me.Requery

    'bring us back to the original record
    Set rs = Me.RecordsetClone
    rs.FindFirst "[User_Comment]= " & lngBookmark
    Me.Bookmark = rs.Bookmark

    Exit_Command63_Click:
    Set rs = Nothing
    Exit Sub

    Err_Command63_Click:
    MsgBox Err.Description
    Resume Exit_Command63_Click

    End Sub
    '---------------------------------------------------------------

    Naeem~
    "There are only 10 people in the world who know binary, those who do and those who dont."

  3. #3
    naeemahmad is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Nov 2013
    Location
    Riverside, USA
    Posts
    46
    Sorry .. should have read your question clearly to make sure I understood. my solution is clearly VBA

    Naeem~

  4. #4
    warrenpage is offline Advanced Beginner
    Windows 8 Access 2013
    Join Date
    Oct 2013
    Posts
    69
    It's okay, I'm glad you replied.

    The problem with VBA is that I am not well-versed in it, and am not comfortable using anything in my database that I am unfamiliar with. Don't misunderstand, please--I sincerely appreciate your posting this code. Learning database design is, of course, an ongoing process, and I'm trying to learn something every single day. I'm not doing this for business, or for profit--I'm doing it for self-improvement. I try to find something everyday to pursue, and then I research it to see if I can understand a solution. Sometimes I do understand; sometimes I don't.

    Anyway, it sounds like this is a little bit beyond me right now. It's easier to write the record down on an index card! I know it can be done, though...the question is whether or not I'm at a point where I can understand it. Thanks to your input, I now have a few things to research, such as bookmarks.

  5. #5
    naeemahmad is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Nov 2013
    Location
    Riverside, USA
    Posts
    46
    Anytime, joined this forum to be of any help..

    .. if you change your mind, attach your dbs form in question (if possible) and perhaps we can get it going for you... VBA is actually very easy to understand and work with..

    Best of luck!

    Naeem~

  6. #6
    lfpm062010 is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2013
    Location
    US
    Posts
    415
    This should work.

    Build a form using form wizard base on the table. Sort the record source on "last modified" (Ascending). Then you should be able to click on the navigate button on the button of the form (if you did not turn it off). It should sent you right to the record.

    Hope this makes sense for you and work for you.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 2
    Last Post: 12-05-2012, 11:33 AM
  2. Replies: 1
    Last Post: 03-19-2012, 11:03 AM
  3. Replies: 7
    Last Post: 01-12-2011, 01:41 PM
  4. Replies: 4
    Last Post: 09-10-2010, 08:00 AM
  5. Create a command button to Browes for file
    By sawill in forum Programming
    Replies: 3
    Last Post: 03-15-2009, 05:02 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums