papadega3000
Registered User.
- Local time
- Yesterday, 19:13
- Joined
- Jun 21, 2007
- Messages
- 80
Hello,
I am trying to create an export function in Access to export a query with filter that is controlled by a combo box then export the query to Excel.
So far I browsed this forum and other sites and put together the VBA code that was used by other to try and accompolish what I want.
After I select it from the form and click the button i get a runtime error 3270 Property Not Found. I am not sure where in the line of code its refering too???
But the compilier points to the docmd line:
DoCmd.OutputTo acQuery, "ExportQuery", "MicrosoftExcel(*.xls)", "", True, ""
If anyone has tried this and has seen the error I'd be pleased to see how it is resolved.
I also zipped up a copy of the DB with some mock data so you can see it.
Thanks,
I am trying to create an export function in Access to export a query with filter that is controlled by a combo box then export the query to Excel.
So far I browsed this forum and other sites and put together the VBA code that was used by other to try and accompolish what I want.
Code:
Private Sub ExportExcel_Click()
Dim StrSQL As String
Dim qdf As QueryDef
StrSQL = "Select * From [ExportQuery] Where [Run.Test_Case]= Forms![Export]![ComboExportTestCase]"
If DLookup("Name", "MSysObjects", "Name= 'ExportQuery'") <> "" Then
Set qdf = CurrentDb.QueryDefs("ExportQuery")
qdf.SQL = StrSQL
Else
Set qdf = CurrentDb.CreateQueryDef("ExportQuery", StrSQL)
End If
DoCmd.OutputTo acQuery, "ExportQuery", "MicrosoftExcel(*.xls)", "", True, ""
'DoCmd.TransferSpreadsheet acExport, 8, "ExportQuery", "ChecklistExport", True, ""
End Sub
After I select it from the form and click the button i get a runtime error 3270 Property Not Found. I am not sure where in the line of code its refering too???
But the compilier points to the docmd line:
DoCmd.OutputTo acQuery, "ExportQuery", "MicrosoftExcel(*.xls)", "", True, ""
If anyone has tried this and has seen the error I'd be pleased to see how it is resolved.
I also zipped up a copy of the DB with some mock data so you can see it.
Thanks,