[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 221
  • Last Modified:

How make navigation buttons appear if more than one filtered record

I have a form with the navigation buttons not visible by default.  But if there is more than one record to be viewed on the form I want the navigation buttons to appear.

How can I do this?

--Steve
0
SteveL13
Asked:
SteveL13
  • 4
  • 4
1 Solution
 
Dale FyeCommented:
You could use the Form_Load event and do something like:

Private Sub Form_Load

    me.NavigationButtons = me.recordsetclone.recordcount > 1

End if

0
 
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)Commented:


How about this:

Private Sub Form_Current()
    If Me.RecordsetClone.RecordCount > 1 Then
        Me.NavigationButtons = True
    Else
        Me.NavigationButtons = False
    End If
End Sub

mx
0
 
Dale FyeCommented:
you mention "more than one filtered record" in your question.

How are you "filtering" the recordset?  Are you doing this with the optional "WhereCondition" parameter of the OpenForm method, or do you actually have a filter functionality on your form?  If the latter, then you would need to include this method within the code sequence you are using to filter the form as well as in the load event.

0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)Commented:
That's why I'm thinking the Current event, because even if when you load, there is only one record, that could change during usage of the form, so the Current event covers both cases.

mx
0
 
Dale FyeCommented:
Joe,

That would, of course, work.  I just didn't see a need to do it on every record.
0
 
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)Commented:
But 'every record' is when it could change dynamically for 1 to >1 ... if adding, deleting, etc.

If you load and there is one, nav is off. But if you add, now you have two. nav is still off. oops.

mx
0
 
SteveL13Author Commented:
The form is "filtered" by a query which drives the information to the form.
0
 
Dale FyeCommented:
That's reasonable, and if you delete, same logic applies.

I almost never use the built-in navigation buttons, and have a routine (as I'm sure you do) I use to control the status of my custom navigation buttons, which gets called from a variety of places (Form_Current, Form_Dirty, MoveWhere, ...)
0
 
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)Commented:
Steve ... pretty sure the Q has been answered.

Dale ... yes, I mentioned deleting above ...

mx
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 4
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now