Results 1 to 5 of 5
  1. #1
    bilalo is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jan 2019
    Posts
    107

    Navigation control

    I have a form "Form1" that contains a navigation control with five navigation buttons and a subform. The five buttons all have the same target form "Form2". I need from each button to apply a different filter on Form2 and shows the result in the subform.

    I tried to add filters on the click event of the navigation control buttons of "Form1" but it showed me an error(control is not bounded or something like that)
    I also tried the Form_Load() of "Form2", I tried to get the tabindex of the navigation control to find which button was clicked in order to apply the correct filter but it always returns 0.
    Any help please

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    if you want to filter Form2, put the controls on form2, then the code is:


    Code:
    '----------------
    sub btnFilter_click()
    '----------------
    dim sWhere as string 
    sWhere = "1=1"
    if not IsNUll(cboST) then sWhere = sWhere & " and [State]='" & cboST & "'"
    if not IsNUll(cboCity) then sWhere = sWhere & " and [city]='" & cboCity & "'"
    if not IsNUll(cboZip) then sWhere = sWhere & " and [ZipCode]='" & cboZip & "'"
    If sWhere = "1=1" Then
      Me.FilterOn = False
    Else
      Me.Filter = sWhere
      Me.FilterOn = True
    End If
    end sub

  3. #3
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,801
    You can use the navigation control selectedtab properties: caption or name. Name is probably cryptic value; caption probably more intuitive to you.

    Forms![navigation form].NavigationControl0.SelectedTab.Caption

    assumes you kept the default name for the nav form (navigation form) and default for control, which may or may not end in 0. Then when same form opens, get this property and do a select case, one case for every tab.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    My preference would be for a normal form with normal command buttons.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    bilalo is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jan 2019
    Posts
    107
    Quote Originally Posted by Micron View Post
    You can use the navigation control selectedtab properties: caption or name. Name is probably cryptic value; caption probably more intuitive to you.

    Forms![navigation form].NavigationControl0.SelectedTab.Caption

    assumes you kept the default name for the nav form (navigation form) and default for control, which may or may not end in 0. Then when same form opens, get this property and do a select case, one case for every tab.
    Thank you, that's what I was looking for

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

Similar Threads

  1. Replies: 3
    Last Post: 10-03-2022, 12:39 PM
  2. Get used with Navigation Control
    By domivax in forum Forms
    Replies: 1
    Last Post: 02-17-2015, 08:06 AM
  3. Replies: 2
    Last Post: 11-27-2014, 01:06 PM
  4. Using Navigation Control
    By PlamenGo in forum Access
    Replies: 9
    Last Post: 04-08-2012, 01:57 AM
  5. Control Navigation Bar
    By Patrick.Grant01 in forum Access
    Replies: 0
    Last Post: 05-17-2009, 06:16 AM

Tags for this Thread

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