Results 1 to 6 of 6

Thread: Newbie Help: Query Builder

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2007
    Posts
    3

    Newbie Help: Query Builder

    I'm in a hurry so I'm sorry if I overlooked something obvious.
    I haven't coded in Visual Basic for well over 5 years so I'm very rusty and I need to create a database frontend that allows a user to see a table in a .mdb and also search through the columns.

    So I do the following:
    1)New Project and add the mdb and table as a data source.
    2)Drag the table into the form and use the query builder to create a search for the Title Column by adding (WHERE Title=?) or (WHERE Title like ?)

    However when I use the search query, it'll only show results that match exactly whats in the search box. I need it to display similiar results as well.

    eg: If I type in Harry Potter, I need it to show three different Harry Potter Titles. If I type in Tolkien I need it to show results for JRR Tolkien as well.

    How do I set this up? It's probably something obvious but like I said I was in a hurry so I possibly overlooked it.

  2. #2
    Registered User nmadd's Avatar
    Join Date
    Jun 2007
    Location
    U.S.A.
    Posts
    1,676

    Re: Newbie Help: Query Builder

    Hi Dag,

    You can use wildcard characters.

    For example:
    %Potter% will match "Potter" anywhere in the title.

    Read a lot more about them here:
    http://office.microsoft.com/en-us/ac...881851033.aspx

    Good luck

  3. #3

    Thread Starter
    New Member
    Join Date
    Jun 2007
    Posts
    3

    Re: Newbie Help: Query Builder

    How would i go about making sure that the % sign is automatically added before and after the text to search for?

  4. #4
    Registered User nmadd's Avatar
    Join Date
    Jun 2007
    Location
    U.S.A.
    Posts
    1,676

    Re: Newbie Help: Query Builder

    Something like this:

    (WHERE Title Like '%' + ? + '%')

  5. #5

    Thread Starter
    New Member
    Join Date
    Jun 2007
    Posts
    3

    Re: Newbie Help: Query Builder

    Oh man, thank you so so much! That worked perfectly.
    Damn, i feel like an idiot for not trying that...but anyway, thanks. My project is finally done.

  6. #6
    Registered User nmadd's Avatar
    Join Date
    Jun 2007
    Location
    U.S.A.
    Posts
    1,676

    Re: Newbie Help: Query Builder

    Glad to help.

Posting Permissions

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



Click Here to Expand Forum to Full Width