Export only certain fields from access to excel

TallMan

Registered User.
Local time
Today, 00:14
Joined
Dec 5, 2008
Messages
239
Hello,

Does anyone know how to export certain fields from an access table to an excel spreadsheet?

I have a tmp table that I currently transfer into a spreadsheet. The issue is I do not need every field. I only need four of them.

I do not want to create another tmp table with only those four fields for space/complexity purposes.

What I am currently doing is

PHP:
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "TBL_TMP", "C:\Process_tmp.xls", True

what I really need is field Column A,B,C,D to transfer to the spreadsheet. Has anyone done anything like this before?


Thanks in advance for your help!
 
Thanks BOB....I always try to keep things in the VBA window as opposed to creating queries...not sure why...I guess it keeps it clutter free. Does it take up more space when you create queries as opposed to using recordsets in vba?

Thanks!
 
Nice. I will give this a try!
 
Hey Bob,

For some reason the "CurrentDb.QueryDefs.Append(qdf.Name)" was throwing an error. I texted it out and it worked fine.
I wish I could figure out how to combine two temp tables into one spreadsheet using this method.

Thanks again for your help!!!
 
I know this is an ancient thread but this code is exactly what I've been looking for and is giving me a mismatch error for the "CurrentDb.QueryDefs.Append (qdf.Name)" line. It sounds like the original poster had the same problem but found a solution. Anyone know what that solution may be?
 
By the sound of it, he commented it out. Try it.
 
Hah...I read his comment but didn't understand what he'd meant by 'texted out'. Your re-wording solved it. Thanks!
 
Great. Kudos for guessing that someone might have had you problem and searching for a solution
 

Users who are viewing this thread

Back
Top Bottom