Export only certain fields from access to excel (1 Viewer)

TallMan

Registered User.
Local time
Today, 10:51
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!
 

TallMan

Registered User.
Local time
Today, 10:51
Joined
Dec 5, 2008
Messages
239
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!
 

TallMan

Registered User.
Local time
Today, 10:51
Joined
Dec 5, 2008
Messages
239
Nice. I will give this a try!
 

TallMan

Registered User.
Local time
Today, 10:51
Joined
Dec 5, 2008
Messages
239
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!!!
 

Tee2

Registered User.
Local time
Today, 08:51
Joined
May 28, 2015
Messages
23
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?
 

spikepl

Eledittingent Beliped
Local time
Today, 15:51
Joined
Nov 3, 2010
Messages
6,144
By the sound of it, he commented it out. Try it.
 

Tee2

Registered User.
Local time
Today, 08:51
Joined
May 28, 2015
Messages
23
Hah...I read his comment but didn't understand what he'd meant by 'texted out'. Your re-wording solved it. Thanks!
 

spikepl

Eledittingent Beliped
Local time
Today, 15:51
Joined
Nov 3, 2010
Messages
6,144
Great. Kudos for guessing that someone might have had you problem and searching for a solution
 

Users who are viewing this thread

Top Bottom