Hey everyone i did some research online but i couldn’t get a solution, hopefully someone here can help. My go is to place a sql statement to a DoCmd.OutputTo
for example
Set tempSql= CurrentDb.OpenRecordset("SELECT * FROM SpecialEvent WHERE [HG_ID] = " & HG_ID & ";")
DoCmd.OutputTo acOutputQuery, "tempSql", acFormatXLS, strDir + "try.xls", 0
If anyone can guide me to building this approach, it would be much appreciated.
You can set the sql of a query to the output sql and use the query name in DoCmd.OutputTo
Note that the concatenator is & in VBA, not +
The plus sign can be used to concatenate, but it needs great care because of the way it works with nulls.