J
Jen
I have an application that should be exporting long strings from an Access
query to an excel spreadsheet. Each week the spreadsheet should be
overwritten. The problem that I'm finding is that the long strings are cut
off (I'm assuming at the 255 char). I have tried the following (as well as
output to) and haven't had any luck. I'm not really proficient with code so I
would need a lot of help if the export has to be done row by row. Any ideas?
Option Compare Database
Public Function CommentConcatenate() As Long
On Error GoTo CommentConcatenate_Err
Dim strSQL As String
Dim strFileFolder As String
Dim strFile As String
Dim strFileSpec As String
strFileSpec = "C:\Documents and Settings\jstandley-magdech\My
Documents\Comments.xls"
'Kill the file
If Len(Dir(strFileSpec)) > 0 Then 'File exists
Kill strFileSpec
End If
strFile = "Comments"
'Template and file save path
strFileFolder = "C:\Documents and Settings\jstandley-magdech\My
Documents\"
If strFile = "" Or IsNull(strFile) Then
GoTo CommentConcatenate_Exit
End If
If strFileFolder = "NA" Then
Err.Raise vbObjectError, , "Unabled to find the save path.",
vbExclamation, CMSG_TITLE
Else
strFile = strFileFolder & strFile & ".xls"
End If
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel8,
"qryCommentConcatenate", _
strFile, True
CommentConcatenate_Exit:
Exit Function
CommentConcatenate_Err:
MsgBox Err.Description, vbExclamation, CMSG_TITLE
Resume CommentConcatenate_Exit
End Function
query to an excel spreadsheet. Each week the spreadsheet should be
overwritten. The problem that I'm finding is that the long strings are cut
off (I'm assuming at the 255 char). I have tried the following (as well as
output to) and haven't had any luck. I'm not really proficient with code so I
would need a lot of help if the export has to be done row by row. Any ideas?
Option Compare Database
Public Function CommentConcatenate() As Long
On Error GoTo CommentConcatenate_Err
Dim strSQL As String
Dim strFileFolder As String
Dim strFile As String
Dim strFileSpec As String
strFileSpec = "C:\Documents and Settings\jstandley-magdech\My
Documents\Comments.xls"
'Kill the file
If Len(Dir(strFileSpec)) > 0 Then 'File exists
Kill strFileSpec
End If
strFile = "Comments"
'Template and file save path
strFileFolder = "C:\Documents and Settings\jstandley-magdech\My
Documents\"
If strFile = "" Or IsNull(strFile) Then
GoTo CommentConcatenate_Exit
End If
If strFileFolder = "NA" Then
Err.Raise vbObjectError, , "Unabled to find the save path.",
vbExclamation, CMSG_TITLE
Else
strFile = strFileFolder & strFile & ".xls"
End If
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel8,
"qryCommentConcatenate", _
strFile, True
CommentConcatenate_Exit:
Exit Function
CommentConcatenate_Err:
MsgBox Err.Description, vbExclamation, CMSG_TITLE
Resume CommentConcatenate_Exit
End Function