Results 1 to 4 of 4
  1. #1
    BillyMo11
    Guest

    How to search a Access Database from VB (Visual Basic)

    In visual basic I have a form set up that has a data control linked to an Acess database and I want to create my own search button. When I do I use the Recordset.FindFirst method and when I type something to search, it finds the first record in the table and then deletes the field I am searching on.

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: How to search a Access Database from VB (Visual Basic)

    Deletes it? Could you explain more? Are you trying to use a bound control to enter search critieria? If so, don't, because you change the value in the bound field when you enter the search value.
    Charlotte

  3. #3
    BillyMo11
    Guest

    Re: How to search a Access Database from VB (Visual Basic)

    Oops I guess the search text box is bound to one of the columns in the database and yes it deletes what was previously in that field. But what is that when I type in a word that I want to search on it seems like it doesn't go through the database, all it does is comes to the first record in the database pulls up that one. Also I have an IF statement that says if no match then display a message, and when I search I get the first record, like I said before and also I get my message from my IF statement.

    Thanks for the help.

  4. #4
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: How to search a Access Database from VB (Visual Basic)

    Why don't you post the code you're trying to use? It would be easier to figure out your problems if we can see what you're actually doing instead of trying to understand it from a description.

    You'll get the first record because that's where you're starting out. It isn't finding whatever you're telling it to find, so there's probably something amiss with your code.
    Charlotte

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •