Results 1 to 4 of 4
  1. #1
    mwc0914 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2013
    Posts
    7

    Must exit Access for query to work a second time


    I am trying to learn Access 2010. I am trying a basic search first, with a button on the form to trigger the query. It works when I run it the first time. But when I go back to my form and change the data value in the text box and click on the button again, the query results are still from the original query. How do I get the query/form/button to work when changing query values, without having to exit Access, then start up Access again and enter new data for the query?

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,619
    How is the search performed? Do you have a parameterized query or do you build filter string with VBA. Fully describe the process and show code or provide db for analysis. Follow instructions at bottom of my post.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    mwc0914 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2013
    Posts
    7
    Form contains 2 text boxes (I am currently only using one of them for the query). Form contains a button to run the query. Query is parameterized. No VBA at all.
    I open Access and go to my form.
    I enter a value in the text box and click on the button to run the query.
    Query is performed and returns the correct dataset.
    I go back to the form and change the value in the text box and click on the button to run the query.
    I go to the query results and they are the same from the first query.

    If I exit Access, then come back in and enter a new value in the text box, then the query works.
    So, in order to perform subsequent queries with different values, I must exit Access and come back in each time. I should not have to do this I would think.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,619
    So you are opening a query object instead of a form or report bound to the query?

    Need to close the query before changing filter criteria then reopen.

    Or modify code to replicate the ribbon RefreshAll. The only method I can find to do that is:

    SendKeys "+({f9})"

    Or use form or report and Requery:
    Forms!formname.Requery
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Replies: 2
    Last Post: 12-20-2012, 03:06 PM
  2. How do I capture Access DB exit event
    By jscriptor09 in forum Access
    Replies: 3
    Last Post: 09-21-2011, 09:45 AM
  3. Cant get Yes/No to work in Query Access 2010
    By colisemo in forum Queries
    Replies: 1
    Last Post: 09-20-2011, 02:21 PM
  4. Date And Time Of Member's Entry And Exit.
    By bhavik1978 in forum Access
    Replies: 4
    Last Post: 09-20-2010, 06:40 AM
  5. Replies: 3
    Last Post: 08-08-2010, 05:33 PM

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