I have a question about an error I received using VBA in MS Word XP . The error message I receive is;
Run-Time
'9105'
String is longer than 255 characters
Here is my code;
' pccmember3 Macro
' Macro recorded 6/22/2005 by meg17-05
'
ActiveDocument.MailMerge.OpenDataSource Name:= _
"F:\bsn-test\Test of AccessCustomerDatabaseXA.mdb", ConfirmConversions:=False, _
ReadOnly:=False, LinkToSource:=True, AddToRecentFiles:=False, _
PasswordDocument:="", PasswordTemplate:="", WritePasswordDocument:="", _
WritePasswordTemplate:="", Revert:=False, Format:=wdOpenFormatAuto, _
Connection:= _
"Provider=Microsoft.Jet.OLEDB.4.0;Password="""";User ID=Admin;Data Source=F:\bsn-test\Test of AccessCustomerDatabaseXA.mdb; _
"Mode=Read;Extended Properties="""";Jet OLEDB:System database="""";Jet OLEDB:Registry Path="""";Jet OLEDBatabase Password="""";Jet OLEDB:Engine Typ" _
, SQLStatement:="SELECT * FROM `registrationPCCMEMBERS`", SQLStatement1:= _
"", SubType:=wdMergeSubTypeAccess
With ActiveDocument.MailMerge
.Destination = wdSendToNewDocument
.SuppressBlankLines = True
With .DataSource
.FirstRecord = wdDefaultFirstRecord
.LastRecord = wdDefaultLastRecord
End With
.Execute Pause:=False
End With
-------------------------------------------
Of course the underscores are new lines which was automatically put in
------------------------------------------------
Here is where VBA highlights the error;
ActiveDocument.MailMerge.OpenDataSource Name:= _
"F:\bsn-test\Test of AccessCustomerDatabaseXA.mdb", ConfirmConversions:=False, _
ReadOnly:=False, LinkToSource:=True, AddToRecentFiles:=False, _
PasswordDocument:="", PasswordTemplate:="", WritePasswordDocument:="", _
WritePasswordTemplate:="", Revert:=False, Format:=wdOpenFormatAuto, _
Connection:= _
"Provider=Microsoft.Jet.OLEDB.4.0;Password="""";User ID=Admin;Data Source=F:\bsn-test\Test of AccessCustomerDatabaseXA.mdb;Mode=Read;Extended Properties="""";Jet OLEDB:System database="""";Jet OLEDB:Registry Path="""";Jet OLEDBatabase Password="""";Jet OLEDB:Engine Typ" _
, SQLStatement:="SELECT * FROM `registrationPCCMEMBERS`", SQLStatement1:= _
"", SubType:=wdMergeSubTypeAccess
I belive it's a simple syntax error somewhere. Does anyone notice where the problem is?
Hopefully, the information above is clear.
Thanks,
KJ
Run-Time
'9105'
String is longer than 255 characters
Here is my code;
' pccmember3 Macro
' Macro recorded 6/22/2005 by meg17-05
'
ActiveDocument.MailMerge.OpenDataSource Name:= _
"F:\bsn-test\Test of AccessCustomerDatabaseXA.mdb", ConfirmConversions:=False, _
ReadOnly:=False, LinkToSource:=True, AddToRecentFiles:=False, _
PasswordDocument:="", PasswordTemplate:="", WritePasswordDocument:="", _
WritePasswordTemplate:="", Revert:=False, Format:=wdOpenFormatAuto, _
Connection:= _
"Provider=Microsoft.Jet.OLEDB.4.0;Password="""";User ID=Admin;Data Source=F:\bsn-test\Test of AccessCustomerDatabaseXA.mdb; _
"Mode=Read;Extended Properties="""";Jet OLEDB:System database="""";Jet OLEDB:Registry Path="""";Jet OLEDBatabase Password="""";Jet OLEDB:Engine Typ" _
, SQLStatement:="SELECT * FROM `registrationPCCMEMBERS`", SQLStatement1:= _
"", SubType:=wdMergeSubTypeAccess
With ActiveDocument.MailMerge
.Destination = wdSendToNewDocument
.SuppressBlankLines = True
With .DataSource
.FirstRecord = wdDefaultFirstRecord
.LastRecord = wdDefaultLastRecord
End With
.Execute Pause:=False
End With
-------------------------------------------
Of course the underscores are new lines which was automatically put in
------------------------------------------------
Here is where VBA highlights the error;
ActiveDocument.MailMerge.OpenDataSource Name:= _
"F:\bsn-test\Test of AccessCustomerDatabaseXA.mdb", ConfirmConversions:=False, _
ReadOnly:=False, LinkToSource:=True, AddToRecentFiles:=False, _
PasswordDocument:="", PasswordTemplate:="", WritePasswordDocument:="", _
WritePasswordTemplate:="", Revert:=False, Format:=wdOpenFormatAuto, _
Connection:= _
"Provider=Microsoft.Jet.OLEDB.4.0;Password="""";User ID=Admin;Data Source=F:\bsn-test\Test of AccessCustomerDatabaseXA.mdb;Mode=Read;Extended Properties="""";Jet OLEDB:System database="""";Jet OLEDB:Registry Path="""";Jet OLEDBatabase Password="""";Jet OLEDB:Engine Typ" _
, SQLStatement:="SELECT * FROM `registrationPCCMEMBERS`", SQLStatement1:= _
"", SubType:=wdMergeSubTypeAccess
I belive it's a simple syntax error somewhere. Does anyone notice where the problem is?
Hopefully, the information above is clear.
Thanks,
KJ