title: Display queries in access subform from a selected listbox
body: <p>Within Access 2010, I am trying to make a form display a query within a subform <code>QueriesSubForm</code> that when selected from listbox <code>QueryListBox</code> and then click on the button <code>runbtn</code>. It is supposed to display the query within the linked subform, and change when you do this whole steps again from a different choice selected on the listbox and click on the button.</p>
  
  <p>At the moment I can only get it to work, if I want it to display the queries in a new task window, when programmed like so:</p>
  
  <p>QueriesListBox Listbox - SQL View</p>
  
  <pre><code>SELECT MSysObjects.[Name]
  FROM MSysObjects
  WHERE (((MSysObjects.[Type])=5) AND ((Left([Name],1))&lt;&gt;"~"))
  ORDER BY MSysObjects.[Name];
  </code></pre>
  
  <p>runbtn Button - VBA View</p>
  
  <pre><code>Private Sub runbtn_Click()
  DoCmd.OpenQuery QueryListBox, acViewNormal
  End Sub
  </code></pre>
  
  <p>It works and appears to just open one of the queries from the queries list and display it to me, which I do not want.</p>
  
  <p>This might be an easy thing, but I can not see how it is done with either SQL, VBA or Macro, which I am guessing is need for this to work</p>