Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / October 2007

Tip: Looking for answers? Try searching our database.

Saving querry results in vba

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
kfng - 06 Oct 2007 02:24 GMT
I've used recordset.open <query string>, CurrentProject.connection to run a
query on a table.  How can I save the results of such query?  I would then
like to show the query results in a listbox and so I'm trying to write the
results to a query which is already a data souce of that listbox.

Many thanks in advance for your comments.
Allen Browne - 06 Oct 2007 06:34 GMT
You already have the query string you need.
You could therefore display the results in a list box by setting its
RowSource property.

Example:
   strSql = "SELECT * FROM Table1;"
   Me.[MyListBox].RowSource = strSql

If the list box has RowSource of Query2, and you wanted to alter that query
so that it has the new SQL statement, you could that like this:
   CurrentDb.QueryDefs("Query2").SQL = strSql
   Me.[MyListbox].Requery

Signature

Allen Browne - Microsoft MVP.  Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

>
> I've used recordset.open <query string>, CurrentProject.connection to run
[quoted text clipped - 4 lines]
>
> Many thanks in advance for your comments.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.