Results 1 to 3 of 3

Thread: Text Box Search

  1. #1
    Join Date
    Oct 2005

    Unanswered: Text Box Search

    Its been a while for me so here I am seeking a little help with an access database!

    I have create a form called FrmSeach and on that form I have a textbox name TxtSearch and a command button name CmdSearch. I also have a query name QrySearch that has a critria.

    What I am attempting to do is have the user enter a street name to search for and when the search button is click it checks to see if the name of the street exist in the database. If it exist generate a message that say it exist or one that says does not exist.

    I know that I have to use the query to do the checks but I don't know how! I am not sure if I was to build the form using the query.

    Is there a vb code that I can use to do this? Where when the search button is click and it checks what has been entered in the text box against what has be recorded in the database.

    Any help from begining to finish will be greatly accepted.

    Thank very very very much.

  2. #2
    Join Date
    May 2005
    In my opinion, the best way to have an SQL dependent on a control is to build it dynamically as needed (when the button is clicked in your case).

    If you just need to check if any records exist that match your criteria though, you might be able to get away with a DCount(). If all you really need to do is "generate a message that say it exist or one that says does not exist", than that might work.
    Me.Geek = True

  3. #3
    Join Date
    Apr 2009
    Try this code, who knows it will help.

    If DCount("*","tablename","txtName='" & TxtSearch & "'")>0 then
    msgbox"Record exist",vbokonly+vbinformation
    msgbox"Record doesn't exist",vbokonly+vbinformation

Posting Permissions

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