Results 1 to 6 of 6
  1. #1
    Kara is offline Novice
    Windows 8 Access 2013 64bit
    Join Date
    Apr 2016
    Posts
    5

    How to run a select query without opening it?

    Hello guys, new to the forums here! I am newb when it comes to Access 2013, I just started a few weeks ago. Here is the question: How to run a select query without opening it? I know it might sound dumb but I've been searching around google for a couple of days now and can't find a proper answer that doesn't use VBA or SQL. I use macros (It's the only way I know how) and I really need help with this.

  2. #2
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 7 32bit Access 2013
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,530
    You can't "run" a SELECT query without opening it. What would be the purpose. What exactly are you try do with the query.
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  3. #3
    Kara is offline Novice
    Windows 8 Access 2013 64bit
    Join Date
    Apr 2016
    Posts
    5
    Well, it's a search query; I have search form which uses text boxes and combo boxes to input the criteria in the search query needed to search for the value I need. I also have a subform within my search form that displays the query results, with this subform I don't need to open search query I have (well I don't really want it to open), so, I was looking for a way run the query without opening it then just display the results in the subform. I am also open for any suggestions as long as I can understand it. Click image for larger version. 

Name:	Capture1.PNG 
Views:	26 
Size:	7.3 KB 
ID:	24483 Click image for larger version. 

Name:	Capture.PNG 
Views:	26 
Size:	296.6 KB 
ID:	24482

  4. #4
    Micron is offline Virtually Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    When does the query run after all the criteria has been selected? I don't see a button to run the query.
    What is the source object for your subform control (i.e. what is the control linked to)?
    AFAIK, the simplest is to link the subform control to your query - that is where it will show when it opens, which might be as soon as your form opens. That depends on what code you have written to control this. If that is the case and you don't like the result, set the subform control object.source with a button click. Try
    Code:
    Forms!yourFormName!Controls.SubformControlName.SourceObject = "Query.yourQueryName"
    Last edited by Micron; 04-28-2016 at 08:32 AM. Reason: dreaded automated 50 character space
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  5. #5
    Kara is offline Novice
    Windows 8 Access 2013 64bit
    Join Date
    Apr 2016
    Posts
    5
    Thanks for the advice! I already found a way to work with it a few hours ago using VBA (which I never thought I'd use). I found the answer from access-programmers.co.uk by John Big Booty, the way it works is it tracks what's inside the textbox while inputting the parameters in the query while requerying the form and listbox. (I replaced the subform with a listbox based on the query I'm using) Thank you for the answer still!

  6. #6
    Perceptus's Avatar
    Perceptus is offline Expert
    Windows 7 64bit Access 2007
    Join Date
    Nov 2012
    Location
    Knoxville, Tennessee
    Posts
    659
    you could run a select query in vba and tell it to only return snapshot data that wasnt linked dynamicly.

    Set RS = CurrentDB.OpenRecordSet("Select * from mytable", dbOpenSnapshot)

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

Similar Threads

  1. Stop query tab from opening
    By billybeer in forum Queries
    Replies: 4
    Last Post: 08-21-2015, 01:42 PM
  2. Replies: 5
    Last Post: 01-24-2015, 12:59 AM
  3. Using a query dao.recordset when opening a report
    By steven22554 in forum Reports
    Replies: 11
    Last Post: 07-17-2014, 11:43 PM
  4. Replies: 5
    Last Post: 05-14-2014, 01:17 PM
  5. Replies: 6
    Last Post: 04-11-2014, 05:51 AM

Tags for this Thread

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