Results 1 to 6 of 6
  1. #1
    andyt_2005 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2014
    Posts
    12

    Search Function- results displayed in same form as submit


    Hi All, Firstly let me say thanks for the posts that have helped me and sorry if i have posted this in the wriong place.Been using a few posts on here to try and help my issue but no luck as of yet. Im trying to use a text box and button to perform a search function in the same form as the data was input. The Db is basically a fault tracking DB so the input will save the fault as open then when i want to close it i use a search box in the header to search for the 'fault Number' and display the results in the same formI have tried so many solutions but as of yet im at a blank. Any help will be greatly welcomed by anyone! I have attached a pic of my form (DB is too big) so you can see what im talkin about
    Attached Thumbnails Attached Thumbnails Untitled.jpg  

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    One way would be to reset the form's record source property:

    Me.RecordSource = "SELECT * FROM TableName WHERE KeyField = " & Me.TextboxName
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    andyt_2005 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2014
    Posts
    12
    This is the search funtion im using at the moment. However this is throwing up all sorts of errors! I am a complete Noob when it comes to Access! Excel im fine But its something about this programme! Where in this would i put that code?Private Sub Search_Click() If IsNull(txt) = False Then Me.Recordset.FindFirst "Faultnumber=" & txt Me!txt = Null If Me.Recordset.NoMatch Then MsgBox "No record found", vbOKOnly + vbInformation, "Sorry" Me!txt = Null End If End IfEnd Sub

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    The answer to where you would put the code:

    http://www.baldyweb.com/FirstVBA.htm
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    andyt_2005 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2014
    Posts
    12
    No Joy with this, Im thinking It would just be easier to make another form ansd somehow pull all the details up in that one. . .

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Your code is hard to read like that, but I'd expect it to set a bookmark. Two links here that may be of interest:

    http://www.baldyweb.com/wherecondition.htm
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Replies: 3
    Last Post: 09-02-2013, 04:33 PM
  2. Search form getting wrong results
    By Ruegen in forum Programming
    Replies: 1
    Last Post: 08-22-2013, 06:32 PM
  3. Replies: 2
    Last Post: 01-21-2013, 11:28 PM
  4. Limiting the results displayed in a report
    By musicalogist in forum Reports
    Replies: 1
    Last Post: 06-10-2010, 04:44 PM
  5. Search Form Results Displayed In Report
    By warrenjburns in forum Forms
    Replies: 1
    Last Post: 03-18-2009, 02:08 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