1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Microsoft Access Search

Discussion in 'Business Applications' started by shanie00, Jun 22, 2012.

Thread Status:
Not open for further replies.
Advertisement
  1. shanie00

    shanie00 Thread Starter

    Joined:
    Jun 22, 2012
    Messages:
    4
    Hi there,

    I'm hitting my head at a brick wall trying to do this. Basically I have created an Access Database and just want to create a search box that I can type in my query and it will search all records in the database and bring those up. I have googled and googled coming up with codes etc which I tried and nothing seems to work and i'm sure its not that difficult but I can't get anywhere with this. I have the database available to send. I would be so grateful for any help.

    Many thanks,
    Shane
     
  2. OBP

    OBP Trusted Advisor

    Joined:
    Mar 8, 2005
    Messages:
    18,834
    Shane, welcome to the Forum.
    When you say "I can type in my query and it will search all records in the database and bring those up", do you mean search all the fields of all the records?
    Or search a field of every record, which is the normal way this is done?
     
  3. Mhouser

    Mhouser

    Joined:
    Jan 21, 2008
    Messages:
    138
    How I setup my Form to do searches:

    Click search button
    button has VBA code on it:
    Me.Recordsource = "SELECT * FROM <query>"
    Me.Requery
    -- This will only show records in the form for the found data.
    -- Tied to the query that is running the search function for you, query has to show all the same columns as the data in the form

    have an Undo Search button
    Me.Recordsource = <make it match the original source>
    -- Will make it so can see all records again
     
  4. shanie00

    shanie00 Thread Starter

    Joined:
    Jun 22, 2012
    Messages:
    4
    Many thanks for your reply. Yes I mean to search fields in the database. How do I input that code you have said as I have tried with button and code but to no avail... I wonder if I could send you database... Basically I want it searchable by name, keywords and Counciller... so i'm not sure if this is three separate searches or one would be easier - those are the three key things in my database that I need to get results from. The reason I need it with search buttons etc is for ease of use for our users.

    Many thanks,
    Shane
     
  5. OBP

    OBP Trusted Advisor

    Joined:
    Mar 8, 2005
    Messages:
    18,834
    Well the name and the Counciller can be handled by Find Combo boxes or by unbound text field, the keywords would use an Unbound text field. So 3 inputs would be best, what fields would you want to search for the Key words?
    The easiest way to achieve this is to set the Form's Filter using VBA code.
     
  6. shanie00

    shanie00 Thread Starter

    Joined:
    Jun 22, 2012
    Messages:
    4
    VBA code? ooops sorry not sure what this is? Any chance you could break it down by action - im using access on 2007 but can do it on 2003 if needs be. I've gone to insert button then right clicked then build event...? then pasted various codes in there for searchs and none that have worked. Sorry to be 'thick'!
     
  7. OBP

    OBP Trusted Advisor

    Joined:
    Mar 8, 2005
    Messages:
    18,834
    VBA code is the programming language behind Macros, it can be very complicated for a beginner, how quick a learner are you?
    I have posted various versions of Search forms on the forum which I cna show you if you think you can pick it up from them?
     
  8. shanie00

    shanie00 Thread Starter

    Joined:
    Jun 22, 2012
    Messages:
    4
    Yes I would say fairly quick learner - definately willing to have a go... This is last bit I need now...
     
  9. OBP

    OBP Trusted Advisor

    Joined:
    Mar 8, 2005
    Messages:
    18,834
    OK, I will find you some examples.
     
  10. OBP

    OBP Trusted Advisor

    Joined:
    Mar 8, 2005
    Messages:
    18,834
    I might just as well show you this one by Allen Browne.
    Note it has a Search button and a reset button.
     

    Attached Files:

  11. Sponsor

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/1058093