Making a "Find" button

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • radink

    #1

    Making a "Find" button

    Hey all,


    I would like to make a command button on a form that lets you enter a
    users name, and then if finds and displays only the records from that
    user in the same form. I've tried doing it via a filter, but I'm not
    sure im doing it correctly.

    Thanks!!
    Mark

  • Rick Brandt

    #2
    Re: Making a "Find&quot ; button

    radink wrote:
    I would like to make a command button on a form that lets you enter a
    users name, and then if finds and displays only the records from that
    user in the same form. I've tried doing it via a filter, but I'm not
    sure im doing it correctly.
    One thing you have to be careful of is if you actually have the data that
    you want to filter on in your form's Recordsource. Is the UserName field
    being displayed with a ComboBox or is the table using a (ugh) Lookup field?
    In those cases you might see one thing on your form, while the actual data
    in the table is something else (like an ID number). The filter obviously
    needs to filter on what is actually there, not necessarily what you see.

    If what you are seeing is the actual data then a filter should work. You
    can apply one with a command button with the following code...

    Dim NameFilter as String
    NameFilter = InputBox("Enter Name to Filter On")

    If NameFilter <"" Then
    Me.Filter = "NameField = '" & NameFilter & "'"
    Me.FilterOn = True
    End If

    --
    Rick Brandt, Microsoft Access MVP
    Email (as appropriate) to...
    RBrandt at Hunter dot com


    Comment

    • radink

      #3
      Re: Making a &quot;Find&quot ; button

      Rick,

      Thanks. As usual I fired this off before looking further. I just made a
      button that ran a macro that runs the Filter By Form command. I gotta
      stop doing that.

      Anyhow, since I have this working, what I would like to do is once the
      use hits that, then they enter the criteria. They have to go up and hit
      the apply filter button. This is ok, but what I would really like to do
      is add another button right on the form that does the same thing. The
      problem is that all of the buttons get grayed in the filter by form
      mode. Any ideas on this?

      I appreciate your help!!
      Thanks
      Mark

      Rick Brandt wrote:
      radink wrote:
      I would like to make a command button on a form that lets you enter a
      users name, and then if finds and displays only the records from that
      user in the same form. I've tried doing it via a filter, but I'm not
      sure im doing it correctly.
      >
      One thing you have to be careful of is if you actually have the data that
      you want to filter on in your form's Recordsource. Is the UserName field
      being displayed with a ComboBox or is the table using a (ugh) Lookup field?
      In those cases you might see one thing on your form, while the actual data
      in the table is something else (like an ID number). The filter obviously
      needs to filter on what is actually there, not necessarily what you see.
      >
      If what you are seeing is the actual data then a filter should work. You
      can apply one with a command button with the following code...
      >
      Dim NameFilter as String
      NameFilter = InputBox("Enter Name to Filter On")
      >
      If NameFilter <"" Then
      Me.Filter = "NameField = '" & NameFilter & "'"
      Me.FilterOn = True
      End If
      >
      --
      Rick Brandt, Microsoft Access MVP
      Email (as appropriate) to...
      RBrandt at Hunter dot com

      Comment

      • Rick Brandt

        #4
        Re: Making a &quot;Find&quot ; button

        radink wrote:
        Rick,
        >
        Thanks. As usual I fired this off before looking further. I just made
        a button that ran a macro that runs the Filter By Form command. I
        gotta stop doing that.
        >
        Anyhow, since I have this working, what I would like to do is once the
        use hits that, then they enter the criteria. They have to go up and
        hit the apply filter button. This is ok, but what I would really like
        to do is add another button right on the form that does the same
        thing. The problem is that all of the buttons get grayed in the
        filter by form mode. Any ideas on this?
        Users have zero access to your buttons in Filter-By-Form view.

        --
        Rick Brandt, Microsoft Access MVP
        Email (as appropriate) to...
        RBrandt at Hunter dot com


        Comment

        • radink

          #5
          Re: Making a &quot;Find&quot ; button

          I was afraid of that.

          Is there a way to show some text on the form only in that view? Like
          "press control whatever to continue"?


          Rick Brandt wrote:
          radink wrote:
          Rick,

          Thanks. As usual I fired this off before looking further. I just made
          a button that ran a macro that runs the Filter By Form command. I
          gotta stop doing that.

          Anyhow, since I have this working, what I would like to do is once the
          use hits that, then they enter the criteria. They have to go up and
          hit the apply filter button. This is ok, but what I would really like
          to do is add another button right on the form that does the same
          thing. The problem is that all of the buttons get grayed in the
          filter by form mode. Any ideas on this?
          >
          Users have zero access to your buttons in Filter-By-Form view.
          >
          --
          Rick Brandt, Microsoft Access MVP
          Email (as appropriate) to...
          RBrandt at Hunter dot com

          Comment

          • Rick Brandt

            #6
            Re: Making a &quot;Find&quot ; button

            radink wrote:
            I was afraid of that.
            >
            Is there a way to show some text on the form only in that view? Like
            "press control whatever to continue"?
            Not that I'm aware of. I think this becomes a "training issue".

            --
            Rick Brandt, Microsoft Access MVP
            Email (as appropriate) to...
            RBrandt at Hunter dot com


            Comment

            Working...