The cosmic perspective reminds us that in space, where there is no air, a flag will not wave - an indication that perhaps flag waving and space exploration do not mix.
BUT I don't have a query I have a vb code that takes an SQL string and places it in a listbox:
ResultsList.RowSource = SQL
I made a query that on the ID I putas a criterion. Forms!InputF!ListBox... problem it only takes the record highlighted in the listbox, not all the records in the listbox once I requery it to do a search.
This wouild be clearer if I could email you an attachment and you can see what I'm getting at...
I want an input form where I enter specific WHERE conditions hit search and generate a result in the listbox and then have ALL the results export to a spreadsheet... I have made a request to even pay for this help.
Reply from Alex Hedley:
Unfortunately TechHelp isn't available at the minute, I'm sure there's a message on the page.
I'm hoping for Rich to release a written tutorial I've done on Exporting Objects from Access which covers this in much detail but for now I'll show you a quick example:
Dim db As DAO.Database Dim qdf As QueryDef
Dim strTempTable As String: strTempTable = "tblTempExport" Dim strTempQuery As String: strTempQuery = "qryTempExport"
strSQL = "SELECT ..."
On Error Resume Next DoCmd.DeleteObject acTable, strTempTable On Error Resume Next DoCmd.DeleteObject acQuery, strTempQuery
strSQL = strSQL & "... INTO " & strTempTable & " FROM ...;"
Set db = CurrentDb() Set qdf = db.CreateQueryDef(strTempQuery) qdf.SQL = strSQL qdf.Execute
qdf.Close
Now I'm putting data from a Query into a Table so I use the Table elsewhere, you could just use the query you've created.
Now you can use this Query in your export command.
Sorry, only students may add comments.
Click here for more
information on how you can set up an account.
If you are a Visitor, go ahead and post your reply as a
new comment, and we'll move it here for you
once it's approved. Be sure to use the same name and email address.
This thread is now CLOSED. If you wish to comment, start a NEW discussion in
Access SQL Seminar Part 2.