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
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