You did not mention anything about exporting. I assume that you want to export the results of the query (i.e. the same records that are displayed in the subform) not the query itself. The query that you create in code, exists only in that code. If you want to use the docmd to export from that query, you have to save the query you created in code as a query in Access & then do the export. The following is a code snippet that does that. This code creates a query called myQuery does the export and then deletes the myQuery after the export is complete.
Code:
Dim dbs As DAO.Database
Dim qdfTemp As DAO.QueryDef
Dim strSQL As String
Dim strQDF As String
Dim strFile As String
Set dbs = CurrentDb
strSQL = "SELECT * FROM table1"
strSQL = strSQL & " WHERE daterec=#" & Me.cboStartDate & "# AND enddate=#" & Me.cboEndDate & "# and company='" & Me.company & "'"
strFile = "mySpreadsheet.xls"
strQDF = "myQuery"
Set qdfTemp = dbs.CreateQueryDef(strQDF, strSQL)
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel3, strQDF, strFile
dbs.QueryDefs.Delete ("myQUERY")
dbs.Close
Set dbs = Nothing