ClaraBarton
Registered User.
- Local time
- Today, 07:58
- Joined
- Oct 14, 2019
- Messages
- 778
I want to export the data from a listbox to Excel.
I pretty much followed the Microsoft Help to come up with the following:
The error I get is wrong data type for one of the arguments (!?)
The only problem I can see would be the qdfTemp and that debugs to
A perfectly fine listbox.
Am I using the querydef wrong?
I pretty much followed the Microsoft Help to come up with the following:
Code:
strSql = Me.lstUsage.RowSource
Set qdfTemp = CurrentDb.CreateQueryDef("", strSql)
filePath = "D:\Documents\Access\Mine\Finances\ExportedData.xlsx"
DoCmd.OutputTo acOutputQuery, qdfTemp, acFormatXLSX, filePath, True
The only problem I can see would be the qdfTemp and that debugs to
Code:
SELECT TransactionID, fAccountID, fNameID, CkDate, CkNum, FullName, IIf(IsNull([CatMemo]),[Memo],[CatMemo]) AS CMemo, CAmount FROM tblNames RIGHT JOIN (tblTransactions LEFT JOIN (tblCategory RIGHT JOIN tblCheckCat ON tblCategory.CategoryID = tblCheckCat.fCategoryID) ON tblTransactions.TransactionID = tblCheckCat.fTransactionID) ON tblNames.NameID = tblTransactions.fNameID WHERE tblTransactions.TTransID Is Null AND CategoryID = 14 And Year([tblTransactions.CkDate]) = 2025 ORDER BY CkDate DESC
Am I using the querydef wrong?