I have the following query behind a button in Access. But I'd like for this button, after running the query to export this data to excel. When I look this up online, I find nothing, not sure if I'm explaining it correctly in order to receive the right answers. Here's the query - how do i add a command to export it to excel?
sqltext = "SELECT i.AcYear, i.Eid, i.EidStaffCode, i.EvalteeID, e.Evalrecno, dbo.Clinic.clinicname, " & _
"e.OH1 , e.OH2, e.OH3, e.OH4, e.OH5, e.OH6, e.CL1,e.CL2, e.CL3, e.SM1, e.SM2, e.SM3, e.SM4, " & _
"e.DS1, e.DS2, e.DS3, e.DS4, e.SD1, e.SD2, e.SD3, e.SD4, e.SD5, e.SD6, e.IS1, e.IS2, e.IS3, " & _
"e.IS4, e.IS5, e.CC1 , e.CC2, e.CC3, e.CC4, e.CC5, e.CC6 " & _
"FROM dbo.R165 AS e INNER JOIN " & _
"dbo.EvalIssue AS i ON e.Evalrecno = i.RecNo INNER JOIN " & _
"dbo.Clinic ON i.sitecode = dbo.Clinic.sitecode " & _
"where i.acyear =" & Me.ComboAcYear & _
" order by 1, 6"