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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

The acOutputQuery to acFormatXLS Truncates to 255 Characters. I need it all. Is there a workaround? 2

Status
Not open for further replies.

Johnnycat1

Programmer
May 4, 2005
71
US
The subject pretty much says it all. I need to be able to export a query to an Excel spreadsheet but I can't have it drop all characters above the allowed 255.

Please help with either a workaround or direction to make this work. Thank you in advance!

The code that I am using is as follows:
Code:
Dim stDocName As String

    stDocName = "QryLessonsLearnedExcel"
    DoCmd.OutputTo acOutputQuery, stDocName, acFormatRTF, "C:\" & Me.Abbreviation & " - Lessons Learned" & Me.year & IIf(Me.month < 10, "0" & Me.month, Me.month) & IIf(Me.Day < 10, "0" & Me.Day, Me.Day) & ".RTF", True

nanos gigantum humeris insidentes

A dwarf on the shoulders of giants...
 
Johnny,

Shouldn't you be using acFormatXLS and use an extension of .xls?
You seem to be exporting to MS Word format.

Link

If that still truncates - how about exporting to .csv?

ATB,

Darrylle

Never argue with an idiot, he'll bring you down to his level - then beat you with experience.
 
What version of Excel?

Skip,
[sub]
[glasses]Just traded in my OLD subtlety...
for a NUance![tongue][/sub]
 
Not really the answer to your question, but would it be easier to say:

Code:
"C:\" & Me.Abbreviation & " - Lessons Learned" & Me.year & [blue]Format(Me.month, "00") & Format(Me.Day, "00")[/blue] & ".RTF"

Have fun.

---- Andy

A bus station is where a bus stops. A train station is where a train stops. On my desk, I have a work station.
 
When I pasted in the code I had left the acFormatRTF in the code. I had been tinkering with RTF in a word table format rather than the Excel format.

The info in the link by Darrylles gave me the direction that I needed. I needed to add the acFormatXLSX format to my object library.
Good post by Andy as well. That bit of code was very old and your method is much cleaner.
Thanks to all!

nanos gigantum humeris insidentes

A dwarf on the shoulders of giants...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top