search

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • lee123
    Contributor
    • Feb 2007
    • 556

    search

    I have a form on which I want to search and find a company name in a datagrid. The button I have I have named cmdsearch but the code to use the "find" I don't understand it. So if someone could explain how to use this method it would be great:

    object.find(cri teria[,skiprows][,searchdirectio n][,start])

    adodc is run by an Access database (2000).

    lee123
    Last edited by Killer42; Dec 29 '07, 12:42 PM.
  • daniel aristidou
    Contributor
    • Aug 2007
    • 494

    #2
    Originally posted by lee123
    I have a form on which I want to search ...
    Could you please state which version of VB you use?
    Last edited by Killer42; Dec 29 '07, 12:44 PM. Reason: Reduced excessive quote block

    Comment

    • lee123
      Contributor
      • Feb 2007
      • 556

      #3
      yes i can i am using vb6.0

      lee123

      Comment

      • daniel aristidou
        Contributor
        • Aug 2007
        • 494

        #4
        Originally posted by lee123
        i am using vb6.0

        lee123
        Could you also post which datagrid you are using eg microsoft datagrid 6
        Since each datagrid uses different methods

        Comment

        • lee123
          Contributor
          • Feb 2007
          • 556

          #5
          yea it's datagrid 6.0 i hope that helps.

          lee123

          Comment

          • lee123
            Contributor
            • Feb 2007
            • 556

            #6
            ok i have entered this in the button:

            Code:
            Private Sub CmdSearch_Click()
                Dim strcompanyname As String
                strcompanyname = InputBox("Enter In A CompanyName Please")
                Adodc1.Recordset.Find "Companyname= '" & strcompanyname & "'"
            End Sub
            but when i search for a record it only searches down and not up. how do i get it to search both ways.

            lee123

            Comment

            • Killer42
              Recognized Expert Expert
              • Oct 2006
              • 8429

              #7
              Not really familar with ADODC, but perhaps you need to do something like MoveFirst before starting the search, so it starts form the beginning. The nice thing about this, of course, is that by not going to the start, you can easily do a "find next" function.

              Comment

              • lee123
                Contributor
                • Feb 2007
                • 556

                #8
                Hey that will work. You know I should of thought of that but I didn't. Thanks killer42 you really are good at this.

                lee123
                Last edited by Killer42; Dec 31 '07, 08:28 AM.

                Comment

                • Killer42
                  Recognized Expert Expert
                  • Oct 2006
                  • 8429

                  #9
                  Thanks for that. I'm just glad we could help.

                  Comment

                  Working...