Results 1 to 3 of 3
  1. #1
    timbo is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Dec 2011
    Posts
    41

    Combo Box Search Form

    I am sure it is very simple to do but I would like to add a button to my form that will show all results based on one field in the table that the form refers to.



    Essentially, I want the button to display all records that correspond to a specified status. For example, all client leads that are classified as "hot".

    How do I do this?

    I think a combo search box may be the way to go but what would the code be that I would need to use to return these results and display all of the "hot" records?

  2. #2
    Robeen is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    Mar 2011
    Location
    Tulsa, Oklahoma.
    Posts
    1,596
    This will work - but I can't say that it is the most elegant way to achieve this.

    1
    I created a 'Continuous' Form using Form Wizard and dropped a few fields onto the form.
    When I ran the Form - it displayed all records.

    2.
    In the Form's Property Sheet - Data Tab - Record Source - I put this SQL statement:
    SELECT [ID], [Order], [Customer], [No_Of_Boxes], [REASON] FROM [TableName] WHERE [Customer] = [Enter Customer Name];
    When I ran the Form I got a prompt saying 'Enter Customer Name'.
    When I entered a legitimare Customer Name - the Form showed all records for that Customer.

    3.
    I added a command Button to the Form Footer section of the Form and put this Code [use Code Builder] in the 'On Click' Event:
    Code:
    Private Sub Command17_Click()
        Me.Requery
    End Sub
    When I clicked the button - it prompted me for another name . . .

    4.
    I also added the Me.Requery to the 'On Load' event of the Form.
    That way - when I close and then open the Form, even though my last Customer's records were up there - I had the immediate option to enter a new Customer name.

    I hope this helps! Let me know if you have questions!
    All the best!

  3. #3
    timbo is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Dec 2011
    Posts
    41
    Brilliant. That worked for me. Thanks!!

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

Similar Threads

  1. Replies: 1
    Last Post: 04-20-2012, 03:16 AM
  2. Multi Field Combo search Form
    By Andyjones in forum Access
    Replies: 3
    Last Post: 03-12-2012, 02:13 PM
  3. Combo Search Form
    By Filmnoir in forum Forms
    Replies: 26
    Last Post: 01-26-2012, 10:12 AM
  4. Search Form - Cascading Combo Boxes
    By WeeTerrier in forum Forms
    Replies: 7
    Last Post: 12-05-2011, 08:26 PM
  5. Create combo search form in subform
    By grant.smalley in forum Forms
    Replies: 6
    Last Post: 02-19-2010, 04:37 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