Results 1 to 4 of 4
  1. #1
    Mahendra1000 is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Sep 2013
    Posts
    101

    Search Query

    Hello,



    I have created a table with name "Main". It consists of fields ID, Author, Title, Abstract, Page and Published.

    I have created a form named "MFORM" with one Text box named "Enter Author Name" and then I created a search button below the text box. [I haven't written any code to search button]

    Then I dragged my Main table into this form bottom and named it as "All Results".

    So, Now my form MFORM looks like below :

    /*

    Enter Author Name :


    Search Button


    All Results : [It displaying all the results]

    ID Author Title Abstract Page Published

    *\


    What I needed?

    If I enter author name as Mike and then click on search button then results should display all the details related to Mike.

    All Results [At the Bottom of my page]

    Should display all the details related to Mike.

    Can anyone of you please help me out how to write a VBA code for this search button?

    please....

  2. #2
    offie is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2013
    Posts
    176
    First of all it would be better to split the Author name into first and last. So you can search you first and/or last name.

    It is not the search button that searches. To search through a table you make a query and specify criteria.

    The way that a form is used is that you enter the criteria into the form

    So make a query, based on the table, in the Author field in the criteria row enter
    Code:
    Like "*" & Forms!FormName!TextXX & "*"
    with TextXX being the name of your textbox (found in properties)


    Drag the query you just made (not the table) into the form.

    What the search button do is it requeries (run again with new criteria) the query. So if you want to use a macro then just select refresh from the dropdown. If you want to use VBA then type in
    Code:
     Me.From.Refresh
    (this is after you select on-click in properties)

  3. #3
    Mahendra1000 is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Sep 2013
    Posts
    101
    Hello Offie,

    Thanks for your valuable reply.

    I had dragged the search query to the bottom of my main page. The form which I had created displaying results in new tab and it's not displaying at the bottom.

    I had attached my database. I just need the search results at the bottom of my main form in stead of displaying in new tab. Could you kinldy have a look into it and let me know on this please.
    Attached Files Attached Files

  4. #4
    Mahendra1000 is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Sep 2013
    Posts
    101
    I got it on my way

    I haven't named the subform which resulted in my queries.....

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Search query
    By ashu.doc in forum Queries
    Replies: 6
    Last Post: 09-20-2012, 04:38 PM
  2. Search Query
    By sgray in forum Queries
    Replies: 7
    Last Post: 02-16-2012, 04:37 AM
  3. Help with search query
    By Sirius in forum Queries
    Replies: 0
    Last Post: 08-08-2011, 03:33 PM
  4. Search query HELP
    By sanos_a in forum Forms
    Replies: 2
    Last Post: 04-07-2011, 06:43 AM
  5. ID search Query
    By clarkej in forum Queries
    Replies: 3
    Last Post: 01-25-2011, 08:03 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums