0

I'm new to access and I need to know if anyone as information on how to export hard coded query to excel.

Here's the query i'm trying to export to excel. I think I might need to covert it to a recordset?

If anyone has information i could read on the property i'm suppose to use let me know! :D

whereAtt = "Select * from tblActionLog where LogID is not null"
Community
  • 1
  • 1
SaladSnake
  • 167
  • 2
  • 2
  • 15
  • 1
    Put the data in a recordset, create a querydef, then export that. Use the following [StackOverflow answer](http://stackoverflow.com/questions/16336025/exporting-recordset-to-spreadsheet) as a guide. Marking this as a duplicate – KevenDenen Jan 08 '15 at 19:08
  • I've seen that answer. The problem is i lack a lot of knoledge on the subject. For example you said "create a querydef". I'm not sure what that means. – SaladSnake Jan 08 '15 at 19:22
  • 2
    Look at the accepted answer to that question. It has all the parts you need to work out your solution. If you aren't familiar with something in the answer, Google it and learn what it means so next time you know how to do it without asking someone else. Empower yourself. – KevenDenen Jan 08 '15 at 19:27
  • 1
    I'm afraid you've gotten the wrong idea. I wasn't ever looking for someone to do it for me; simply point me in a direction which i can find information on the property. I didn't want to import another persons skeleton and fill in the blanks, it's just not the way i learn. I can assure you I have google'd it and the issue is i keep getting answers that are diluted with making a query with access and using that to export to excel, which is not what im looking for. I figured the guys on this forum would be able to help me find the place im looking for. – SaladSnake Jan 08 '15 at 19:39
  • 2
    The information in the accepted answer to the linked question is specifically what you asked for: *A direction which I can find information on the property*. That answer contains *a hard coded query* (which is exactly the same as what you've shown here), the means to export it to Excel, and the information on what you should research for more information. What more besides *everything you've asked for* would you like us to provide? – Ken White Jan 08 '15 at 20:01

1 Answers1

1

Can you save your hard coded query as an Access Query? If so, you can just make a button that when clicked runs this code:

DoCmd.OutputTo acOutputQuery, "YourQueryName", acFormatXLS, , True

Would be a lot easier than the other solution.

happydba
  • 103
  • 8
  • He has a hard coded query. Looking at his history of questions, he has built that query in VBA. Doing it from the front end is not what he is looking for. The answer linked is doing exactly what you suggest. Creating a queryDef programmatically is the same as creating a query from the front end. It creates a query object, that if you don't clean up (as the linked answer shows), will be in your list of queries from the front end. – KevenDenen Jan 08 '15 at 21:05
  • Yeah your right! Not sure if i'm allowed to create a query. Working with a lot of restrictions. I'll figure it out. Thanks for the help Keven and Wendy. – SaladSnake Jan 08 '15 at 21:37