Access transfertext macro missing headers

avoorheis
avoorheis used Ask the Experts™
on
The macro does transfer the query data to a text file as desired (I am using a specification), but, I can't get the header from the query to show up in the text file. Is there a special trick?

thanks
alan
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Infotrakker Software
Most Valuable Expert 2012
Top Expert 2014
Commented:
TransferText has the option named "HasFieldNames", which should be toggled to True if you want to include those field names when exporting/importing. Have you set that to True? If you have, and if you're still having troubles, then it's possible that you have issues with your field names. Are you using non-standard field names for anything? For example, do you have columns named "Office Locations in Denver, Colorado"?

In some cases you can build a query that will "alias" the column headers. To do this, you build a query just as you always do, but you then tell the Query Designer what name to "output" for that column. This is done by using syntax like this in the Name row (the first row of your query design grid):

OfficeLocs: [Office Locations in Denver, Colorado]

this would build a query with a column named OfficeLocs, and that query would contain the information from the column named "Office Locations in Denver, Colorado". You could then use that query in your TransferText process.

Author

Commented:
thanks
Yes, I've tried HasFieldNames both ways, no luck. If I don't use a spec (just the default delimited format) the field names do appear (quoted and coma separated, which is what I don't want).

The original query is a pass through, which was giving me problems trying to export, so, made a standard query using the passthrough as the source. Exports ok, except missing the headers.

Nothing unusual about the header, no spaces, comas or even underscores. I'll try a really simple query or table just to make sure it works at all.

Author

Commented:
just tested with simple table using a spec and no headers. I noticed in the spec there isn't anything about headers, but, I did set the macro's transfertext parameter, Has Field Names, to yes.
I'm using access 2007.
I'm stuck now. Could have sworn I've done this before.

Author

Commented:
well, i got it to work in vba.
I created an export specification and used that, but, the export specification will not show up (or work if I type it in) in the macro.
Maybe it's not possible in a macro?
Scott McDaniel (EE MVE )Infotrakker Software
Most Valuable Expert 2012
Top Expert 2014

Commented:
That's quite possible, considering you're building a the output based on a query, which is itself based on a query that is a passthrough.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial