Results 1 to 5 of 5
  1. #1
    cmathews is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    Dec 2018
    Posts
    3

    Run query from a form and query opens

    I am new to Access so I apologize for the dumb question in advance. I have researched on the web but still can not figure out what I am doing wrong,


    I have a form with a subform. I have a text box where I enter a value the click a command button to run a query and return the results in the subform. It works fine except that it opens the query results in a separate tab in addition to showing the results in the subform.
    How can I get it not to open the query results in the separate tab?

    Thank you

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    Need to post your code so we can analyze and suggest changes.
    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
    cmathews is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    Dec 2018
    Posts
    3
    Here is my subform in design view
    Click image for larger version. 

Name:	access form.jpg 
Views:	9 
Size:	198.6 KB 
ID:	36522

    This is my code for the command button click

    Private Sub Command2_Click()
    DoCmd.OpenQuery "SuperValu Query"
    Me!MySubForm.Requery
    End Sub

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    Remove the OpenQuery line. Delete it.
    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.

  5. #5
    cmathews is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    Dec 2018
    Posts
    3

    Thanks!

    Quote Originally Posted by June7 View Post
    Remove the OpenQuery line. Delete it.

    Thank you, that worked!

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

Similar Threads

  1. Replies: 3
    Last Post: 07-12-2017, 12:03 PM
  2. Replies: 3
    Last Post: 01-09-2017, 03:27 PM
  3. Replies: 2
    Last Post: 02-20-2014, 09:53 AM
  4. Replies: 21
    Last Post: 08-05-2013, 06:23 AM
  5. Replies: 5
    Last Post: 10-06-2011, 05:49 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