Merge string corrupt after 255 characters

C

Chris Cooil

My problem is this; I have a button that feeds fields into a word merge file.
It all works fine apart from the field [fulltext] which is a recordset called
fullstring. This merge field becomes corrupt after 255 characters. I'm sure
this string should be a variable length string therefore I shouldn't be
having this problem. Can anyone shed any light on why this may be happening??

Dim myDB As Database
Dim myrs As Recordset
Dim startSQL As String
Dim fullString As String
Dim t As Integer
Dim mySQL As String

startSQL = "SELECT [tblAgreement+RegTEMP].AgreementNo,
[tblAgreement+RegTEMP].Reg FROM [tblAgreement+RegTEMP] WHERE
((([tblAgreement+RegTEMP].Choose)=-1));"

Set myDB = CurrentDb
Set myrs = myDB.OpenRecordset(startSQL)

myrs.MoveLast
myrs.MoveFirst

For t = 0 To myrs.RecordCount - 1
fullString = fullString & myrs![AgreementNo] & "
" & myrs![Reg] & vbCrLf
myrs.MoveNext
Next t

myrs.close
Set myDB = Nothing

'mySQL = "SELECT tblSubsidary.SubsidiryName, tblAgreement.Reg, '" &
fullString & "' AS FullText FROM tblAgreement;"
mySQL = "SELECT tblSubsidary.*,'" & fullString & "' AS FullText,
CurrentUser() AS User, tblSubsidary.CustomerMCC FROM tblSubsidary WHERE
(((tblSubsidary.CustomerMCC)='" & [Forms]![frmAgreement\Reg]![CustomerMCC] &
"'));"


MergeAllWord (mySQL)


Exit Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top