Results 1 to 5 of 5
  1. #1
    MikeN is offline Advanced Beginner
    Windows 7 64bit Access 2013
    Join Date
    Jan 2015
    Posts
    39

    Prevent "Next Record" button from opening new record after displaying last record

    I have an 'edit records' form that opens records associated to a selection made in a previous listbox. I want to put a control button where the user can click to move to the next/previous record but it automatically wants to begin a new blank record once it gets to the end of the available records. How do I stop a 'go to next record button' from opening up a new blank record. I would like for a msgbox to pop up when the user gets to end of the associated records that says something along the lines of "This is the last available record for..."

    The 'edit records' form is the same form that the user would use to enter new records...with some different controls (that are normally hidden on the add new record view) and is opened in acFormEdit...so I don't want to change form properties that might influence the 'add new record' form too, if I can prevent it.



    Any suggestions?

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    set the form property ADD NEW RECORD = false
    or
    prop: CYCLE RECORDS, set to existing only

  3. #3
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Code:
    Private Sub Go2Next_Click()
    
      If Me.CurrentRecord = Me.RecordsetClone.RecordCount Then
     
        Msgbox "This is the Last Record Available!"
    
      Else
    
        DoCmd.GoToRecord , , acNext
    
      End If
    
    End Sub

    Linq ;0)>

  4. #4
    MikeN is offline Advanced Beginner
    Windows 7 64bit Access 2013
    Join Date
    Jan 2015
    Posts
    39
    Thanks Linq! That worked!

  5. #5
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Glad we could help!

    Linq ;0)>

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

Similar Threads

  1. Replies: 2
    Last Post: 11-07-2014, 02:53 PM
  2. Replies: 6
    Last Post: 07-13-2014, 10:13 PM
  3. Replies: 4
    Last Post: 05-16-2014, 12:32 PM
  4. Replies: 7
    Last Post: 11-30-2013, 12:33 PM
  5. Replies: 10
    Last Post: 03-15-2013, 05:46 AM

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