I have a table full of entries with many different codes. I've created a recordset with a unique list of those codes and I'm now wanting a query to use the code that I'm on in the recordset to select those records and save them in an excel file.
This is what I've tried but it isn't working.
Dim rstCode As Recordset
Set rstCode = db.OpenRecordset("Table"
strSQL = "SELECT [1 Select Code].Ext, [1 Select Code].Name, " _
& "From [1 Select Code] " _
& "WHERE ((([1 Select Code].Code) =" & Chr(34) & rstCode!Code _
& Chr(34) & "
) " _
& "ORDER BY [1 Select Code].Ext;"
Dim qdfCode As QueryDef
Set qdfCode = db.CreateQueryDef("", strSQL)
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel4, qdfCode, "C:\test\" & rstCode!Code
Has anyone got any ideas. Its the "qdfCode" bit in the transfer spreadsheet thats not working.
This is what I've tried but it isn't working.
Dim rstCode As Recordset
Set rstCode = db.OpenRecordset("Table"
strSQL = "SELECT [1 Select Code].Ext, [1 Select Code].Name, " _
& "From [1 Select Code] " _
& "WHERE ((([1 Select Code].Code) =" & Chr(34) & rstCode!Code _
& Chr(34) & "
& "ORDER BY [1 Select Code].Ext;"
Dim qdfCode As QueryDef
Set qdfCode = db.CreateQueryDef("", strSQL)
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel4, qdfCode, "C:\test\" & rstCode!Code
Has anyone got any ideas. Its the "qdfCode" bit in the transfer spreadsheet thats not working.