+ Reply to Thread
Results 1 to 11 of 11

Thread: User interface to search for records in table

  1. #1
    Forum Contributor
    Join Date
    11-17-2009
    Location
    PA USA
    MS-Off Ver
    Excel 2000
    Posts
    174

    User interface to search for records in table

    I'm a complete rookie in Access. I have a database with one table. The table has two fields, part number and tool number.

    I need to develop a user interface that will allow the user to enter a part number or a tool number and click a button to list all the entries in the table that match the number entered by the user. See the attached image, this is what I want the form to look like. The table should populate with the matching entries.

    I have no idea where to start. Do I create a query or a form or a report? Any tips to tutorials or any basic help would be appreciated. Thank you for helping me.

    Access 2000
    Attached Images Attached Images
    Last edited by proepert; 03-09-2011 at 04:09 PM.

  2. #2
    Valued Forum Contributor alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Lake County, Illinois
    MS-Off Ver
    MS Office 2010, 2007 and 2002
    Posts
    1,161

    Re: User interface to search for records in table

    Here is how I would attack this.

    I would first create a search form. In that search form I would put the criteria for a query that I wish to have Access look for. In the bottom of the search form, I would insert a subform that is linked to the query that you have searched.

    Here is a link on how to create a search form.

    http://www.datapigtechnologies.com/f...earchform.html

    Here are two links on building subforms

    http://www.datapigtechnologies.com/f...subforms1.html

    http://www.datapigtechnologies.com/f.../subform2.html

    I hope this helps you with your project. Post back if you encounter any issues.

    Alan

  3. #3
    Forum Contributor
    Join Date
    11-17-2009
    Location
    PA USA
    MS-Off Ver
    Excel 2000
    Posts
    174

    Re: User interface to search for records in table

    Thank you very much. The video tutorials are very good. I attached my example database. When the Search button is clicked the query runs but it opens in a separate window, not in the sub-form within the main form.

    I think there are two sub-forms, one was a mistake or rookie error.

    Thanks for helping me.
    Attached Files Attached Files
    Last edited by proepert; 03-09-2011 at 02:28 AM.

  4. #4
    Valued Forum Contributor alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Lake County, Illinois
    MS-Off Ver
    MS Office 2010, 2007 and 2002
    Posts
    1,161

    Re: User interface to search for records in table

    After looking at your database and thinking about it, I have what I believe is an easier and more straight forward solution.

    What I would do is make the search form bound to the query. I would then put the controls you show as search criteria in the HEADER of this form. I would also make them Combos rather than just text boxes so the user can be assured of using actual data. Delete the subform and make the results a datasheet in the searchform.

    Then the code behind your search button is one line:

    Me.Requery


    Give this a shot and see what happens.

  5. #5
    Valued Forum Contributor alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Lake County, Illinois
    MS-Off Ver
    MS Office 2010, 2007 and 2002
    Posts
    1,161

    Re: User interface to search for records in table

    I played around with your db. Look at the attached. I did not make them combos because doing so, would require two tables. One for the PartNum and one for the toolnum and I was not sure how this would play out with the overall project.
    Attached Files Attached Files

  6. #6
    Forum Contributor
    Join Date
    11-17-2009
    Location
    PA USA
    MS-Off Ver
    Excel 2000
    Posts
    174

    Re: User interface to search for records in table

    Thanks again Alan.

    Can you explain a little more about post #4? I would like the results to show in a "datasheet" within the search form if possible.

  7. #7
    Valued Forum Contributor alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Lake County, Illinois
    MS-Off Ver
    MS Office 2010, 2007 and 2002
    Posts
    1,161

    Re: User interface to search for records in table

    I tried to get a datasheet but couldn't figure out how to get a datasheet and a header and therefore went to the continuous form as shown in #5. I will continue to search for an answer as time allows. You may want to do the same by doing a Google search.

    Ok. Got it figured. You need to have a subform in the main form for the datasheet to work. But you need to put your search criteria in the header. Then use the me.requery on the command button.

    Alan
    Last edited by alansidman; 03-09-2011 at 02:44 PM.

  8. #8
    Valued Forum Contributor alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Lake County, Illinois
    MS-Off Ver
    MS Office 2010, 2007 and 2002
    Posts
    1,161

    Re: User interface to search for records in table

    Fixed the example that I showed you earlier. Here is a new presentation attached. Needed to have a subform, with the search criteria in the header. Additionally, needed to not have the subform associate in the main form with any fields.

    Alan
    Attached Files Attached Files

  9. #9
    Forum Contributor
    Join Date
    11-17-2009
    Location
    PA USA
    MS-Off Ver
    Excel 2000
    Posts
    174

    Re: User interface to search for records in table

    Wow thank you very much, again.

    This is exactly what I needed. And I learned alot along the way.

  10. #10
    Valued Forum Contributor alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Lake County, Illinois
    MS-Off Ver
    MS Office 2010, 2007 and 2002
    Posts
    1,161

    Re: User interface to search for records in table

    Glad to be of help. I also learned a few new things with this issue. I find that is often the case when trying to resolve problems others have.

    Alan

  11. #11
    Forum Contributor
    Join Date
    11-17-2009
    Location
    PA USA
    MS-Off Ver
    Excel 2000
    Posts
    174

    Re: User interface to search for records in table

    And I successfully used your second video on subforms to add this:

    Me.mainquery_subform.Form.Visible = False in the Form_Activate and clear buttons code
    and
    Me.mainquery_subform.Form.Visible = True on the search button code

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.2.0