Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Forums   Help   Contact   Merch   Join   Order   Logon  
 
Back to Access Forum    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
Custom Navigation Buttons
Glenn Hatton 
      
2 years ago
I created a form which has four navigations buttons defined. depressing the buttons update the form navigating it to different records ie First, Previous, next and last record. They work fine. If I set the form Navigation buttons to No in the form property sheet then it also disables my custom defined buttons and they are 'Greyed out'

How do I hide the Navigation bar across the bottom of my form but still leave my custom buttons active. The VB code defined to the four buttons is quite simple:

DetailsPrivate Sub FirstBtn_Click()

    On Error Resume Next
    DoCmd.GoToRecord , , acFirst

End Sub

Private Sub BackBtn_Click()
    
    On Error Resume Next
    DoCmd.GoToRecord , , acPrevious

End Sub


Private Sub NextBtn_Click()
    
    On Error Resume Next
    DoCmd.GoToRecord , , acNext

End Sub
Private Sub LastBtn_Click()

    On Error Resume Next
    DoCmd.GoToRecord , , acLast

End Sub


Private Sub Form_Current()

    On Error Resume Next
    If Me.CurrentRecord = 1 Then
        Me.FirstBtn.Enabled = False
        Me.BackBtn.Enabled = False
        Me.FirstBtn.UseTheme = False
        Me.BackBtn.UseTheme = False
        
    Else
        Me.FirstBtn.Enabled = True
        Me.BackBtn.Enabled = True
        Me.FirstBtn.UseTheme = True
        Me.BackBtn.UseTheme = True

    End If
    If Me.CurrentRecord = Me.Recordset.RecordCount Then
        Me.LastBtn.Enabled = False
        Me.NextBtn.Enabled = False
        Me.LastBtn.UseTheme = False
        Me.NextBtn.UseTheme = False
        
    Else
        Me.LastBtn.Enabled = True
        Me.NextBtn.Enabled = True
        Me.LastBtn.UseTheme = True
        Me.NextBtn.UseTheme = True
        
    End If
        
End Sub


Juan C Rivera  @Reply  
            
2 years ago
Look in the property of the form.  turn off navigation to remove it from the form.
Juan C Rivera  @Reply  
            
2 years ago

Kevin Robertson  @Reply  
          
2 years ago
A couple of code blocks you could try.

Code 1:
Details    ' Check if there are no records
    If Me.Recordset.RecordCount = 0 Then
        FirstBtn.Enabled = False: FirstBtn.UseTheme = False
        BackBtn.Enabled = False: BackBtn.UseTheme = False
        LastBtn.Enabled = False: LastBtn.UseTheme = False
        NextBtn.Enabled = False: NextBtn.UseTheme = False
    Else
        ' Check if at the first record
        If Me.Recordset.AbsolutePosition = 0 Then
            FirstBtn.Enabled = False: FirstBtn.UseTheme = False
            BackBtn.Enabled = False: BackBtn.UseTheme = False
            LastBtn.Enabled = True: LastBtn.UseTheme = True
            NextBtn.Enabled = True: NextBtn.UseTheme = True
        ' Check if at the last record
        ElseIf Me.Recordset.AbsolutePosition = Me.Recordset.RecordCount - 1 Then
            FirstBtn.Enabled = True: FirstBtn.UseTheme = True
            BackBtn.Enabled = True: BackBtn.UseTheme = True
            LastBtn.Enabled = False: LastBtn.UseTheme = False
            NextBtn.Enabled = False: NextBtn.UseTheme = False
        Else
            ' Otherwise, enable all buttons
            FirstBtn.Enabled = True: FirstBtn.UseTheme = True
            BackBtn.Enabled = True: BackBtn.UseTheme = True
            LastBtn.Enabled = True: LastBtn.UseTheme = True
            NextBtn.Enabled = True: NextBtn.UseTheme = True
        End If
    End If


Code 2:
Details    FirstBtn.Enabled = Not (Me.CurrentRecord = 1)
    BackBtn.Enabled = Not (Me.CurrentRecord = 1)
    
    On Error Resume Next
    Me.RecordsetClone.AbsolutePosition = Me.Recordset.AbsolutePosition
    Me.RecordsetClone.MoveNext
    On Error GoTo 0
    
    NextBtn.Enabled = Not Me.RecordsetClone.EOF
    LastBtn.Enabled = Not Me.RecordsetClone.EOF
    
    If Me.NewRecord Then
        NextBtn.Enabled = False
    Else
        NextBtn.Enabled = True
    End If

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Access Forum.
 

Next Unseen

 
New Feature: Comment Live View
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2026 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 5/6/2026 9:54:01 AM. PLT: 1s