Results 1 to 3 of 3
  1. #1
    waqas is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Aug 2011
    Posts
    117

    Question navigation for records with buttons

    dear experts. i have two questions.



    1. how can i make my own navigation buttons for next, previous, first and last record.

    2. i want to update changes in existing record and these changes i want to update as new record in another table how can i make in form.

    kindly guide me.

  2. #2
    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
    As to your first question, I think each Sub is self-explanatory:

    Code:
    Private Sub Go2New_Click()
      DoCmd.GoToRecord , , acNewRec
    End Sub

    Code:
    Private Sub Go2First_Click() 
      DoCmd.GoToRecord , , acFirst 
    End Sub

    Code:
    Private Sub Go2Last_Click()
      DoCmd.GoToRecord , , acLast 
    End Sub

    Code:
    Private Sub Go2Prev_Click()
    
      If Me.CurrentRecord = 1 Or Me.CurrentRecord = acNew Then
    
    	DoCmd.GoToRecord , , acLast
    
      Else
      
    	DoCmd.GoToRecord , , acPrevious
    
      End If
    
    End Sub


    Code:
    Private Sub Go2Next_Click()
    
      If Me.CurrentRecord = Me.RecordsetClone.RecordCount Or Me.NewRecord = True Then
     
    	DoCmd.GoToRecord , , acFirst
    
      Else
    
    	DoCmd.GoToRecord , , acNext
    
      End If
    
    End Sub

    If you get to the end of the Recordset, hitting Next or Previous 'wraps' it to the First Record or the Last Record, respectively. If you don't want this behavior you can use these Subs to
    do nothing if on the First Record or Last Record, or pop a Messagebox telling the user the situation and then do nothing.

    Sorry, but I have absolutely no idea of what you're asking in your second question!

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  3. #3
    waqas is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Aug 2011
    Posts
    117
    thanks linq,

    my second questions is, i have master detail form and i want to insert a new record in detail form which user make change in master form.

    like an employee has designation "Driver" from 01-01-07 to 31-01-09 in detail form now if user change his designation in master form it should insert a new record in detail form with new position and date of effect date.

    how can i do?

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

Similar Threads

  1. Navigation Record Buttons in Forms
    By jaarons in forum Forms
    Replies: 4
    Last Post: 01-02-2013, 09:57 PM
  2. Record navigation buttons work backward
    By jonesy29847 in forum Access
    Replies: 22
    Last Post: 04-11-2011, 06:17 AM
  3. Navigation Buttons Stop My Code
    By millerdav99 in forum Programming
    Replies: 6
    Last Post: 03-18-2011, 11:13 AM
  4. Navigation buttons deafult saving
    By accesscoder in forum Forms
    Replies: 3
    Last Post: 10-16-2010, 03:24 PM
  5. Navigation Buttons not working please help
    By dinarocks74 in forum Access
    Replies: 3
    Last Post: 06-26-2009, 10:15 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