Results 1 to 10 of 10
  1. #1
    rhubarb is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Sep 2011
    Posts
    76

    Button OnClick to trigger Query results

    Hello,

    I think this question goes here but may be wrong. I have a form with an edit box for user entered data. I want the user to enter a couple of numbers or letters and hit the "find" button. Once the find button is triggered, the data the user entered will be matched against possible matches in a table. I have a query linked to the form and the text box that does this already. I've created a simple macro to 'OpenQuery' that query but it doesn't seem to run successfully. I hit run and "Enter Parameter Value" pops up and I enter a couple of numbers that would match a result in my table but nothing happens.

    Any insight is appreciated.

    Thank you!

  2. #2
    burrina's Avatar
    burrina is offline VIP
    Windows 8 Access 2010 32bit
    Join Date
    Oct 2012
    Location
    Freeport,Texas
    Posts
    1,383
    What data type is the edit box, a combobox or just a plain textbox? Here is an example of a ComboBox Lookup. This example finds a Job Number in tblJobs


    Set rs = Me.Recordset.Clone
    rs.FindFirst "[jobid] = " & Str(Nz(Me![cbojob], 0))
    If Not rs.EOF Then Me.Bookmark = rs.Bookmark
    Me.cbojob = Null
    HTH

  3. #3
    rhubarb is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Sep 2011
    Posts
    76
    Just a plain text box.

  4. #4
    burrina's Avatar
    burrina is offline VIP
    Windows 8 Access 2010 32bit
    Join Date
    Oct 2012
    Location
    Freeport,Texas
    Posts
    1,383
    Can you post a Demo copy with all confidential data removed for evaluation?

  5. #5
    rhubarb is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Sep 2011
    Posts
    76
    Attached. Let me know if I can make more sense of it.


    Database1.accdb

  6. #6
    burrina's Avatar
    burrina is offline VIP
    Windows 8 Access 2010 32bit
    Join Date
    Oct 2012
    Location
    Freeport,Texas
    Posts
    1,383
    There is NO frmCustomer in this db?

  7. #7
    rhubarb is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Sep 2011
    Posts
    76
    The Job Address form is the frmCustomer

  8. #8
    rhubarb is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Sep 2011
    Posts
    76
    I did forget to add the Macro 'cmd_Find' for the OnClick for the Find button. It just uses the OpenQuery, Datasheet View, and Read Only for data.

  9. #9
    burrina's Avatar
    burrina is offline VIP
    Windows 8 Access 2010 32bit
    Join Date
    Oct 2012
    Location
    Freeport,Texas
    Posts
    1,383

    Trigger Query Results

    There are plenty of ways to do this. Here is your db modified.


    HTH
    Attached Files Attached Files

  10. #10
    rhubarb is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Sep 2011
    Posts
    76
    Just curious, why did you choose a combo box for the entry? Also, when I migrate the code over the combo box drops the addresses properly but when I click on the button it does not open the query. Thanks for the help on this.

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

Similar Threads

  1. how to trigger a button event at same form
    By newaccess in forum Forms
    Replies: 10
    Last Post: 03-01-2013, 10:02 AM
  2. Replies: 6
    Last Post: 10-11-2012, 02:19 PM
  3. Trigger event with button click
    By AMAS in forum Forms
    Replies: 8
    Last Post: 06-07-2012, 09:42 AM
  4. OnClick Cmd Button vs Image
    By mseeker22 in forum Programming
    Replies: 1
    Last Post: 07-14-2011, 08:28 AM
  5. Change Value using Button OnClick
    By nchesebro in forum Programming
    Replies: 1
    Last Post: 06-23-2011, 02:47 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