Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Temp Query and export to Excel

Status
Not open for further replies.

MJCoxy

Programmer
Nov 22, 2001
16
0
0
US
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.
 
mjcoxy

I think the code should be in the araina format not syntax as used by losers.

it should say

format.araina.sec = ex.form1.text

i can see why you have been plerplexed by this!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top