Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.mailmerge.fields
JeffT JeffT is offline
external usenet poster
 
Posts: 3
Default Word 2003 Merge with Sybase Database Query as datasource.

Hello. I am a newbie here. I need some help.
A little history: I wrote a form letter generation system in VB 4.0 about 10
years ago and it has been used to merge data into many thousands of letters
usin MS word 2.0.
The problem: My company now says we have to upgrade the servers and Word for
security reasons. I have converted the VB program to VB.NET and upgraded Word
to Microsoft Office Word 2003 (11.8202.8202) SP3. But nothing works.
The program launches correctly and connects to the Sybase database, gets its
recordset of variables to merge and then opens Word, and Stops at the point
the merge is supposed to take place.
Does anyone have any I dea of a setting or option that I might need to change?
I already turned off all the options in the track changes section.
Thank you for any help,
Jeff
  #2   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Doug Robbins - Word MVP Doug Robbins - Word MVP is offline
external usenet poster
 
Posts: 8,832
Default Word 2003 Merge with Sybase Database Query as datasource.

Not without seeing the code. (Though I am not sure that I can help with
VB.NET, but someone may be able to)

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"JeffT" wrote in message
...
Hello. I am a newbie here. I need some help.
A little history: I wrote a form letter generation system in VB 4.0 about
10
years ago and it has been used to merge data into many thousands of
letters
usin MS word 2.0.
The problem: My company now says we have to upgrade the servers and Word
for
security reasons. I have converted the VB program to VB.NET and upgraded
Word
to Microsoft Office Word 2003 (11.8202.8202) SP3. But nothing works.
The program launches correctly and connects to the Sybase database, gets
its
recordset of variables to merge and then opens Word, and Stops at the
point
the merge is supposed to take place.
Does anyone have any I dea of a setting or option that I might need to
change?
I already turned off all the options in the track changes section.
Thank you for any help,
Jeff



  #3   Report Post  
Posted to microsoft.public.word.mailmerge.fields
JeffT[_2_] JeffT[_2_] is offline
external usenet poster
 
Posts: 1
Default Word 2003 Merge with Sybase Database Query as datasource.

Doug,
Thank you for the response.
Here is the sub routine that merges the documents.
The process stops at the line with *=*=*=*=*=*=*=*=*
Any ideas would be appreciated.
No errors are returned, the process just stops.

*********************************
Public Sub Do_MailMerge(ByRef wdapp As Word.Application)

Dim adoMergeRS As ADODB.Recordset
Dim strSQL As String
On Error GoTo MergeError

strSQL = "Select * from " & tablename & " where swLetterHistId = " &
adoInitialRS.Fields("swLetterHistId").Value

adoMergeRS = New ADODB.Recordset
'Opening the recordset
adoMergeRS.Open(strSQL, dbconnection, ADODB.CursorTypeEnum.adOpenStatic,
ADODB.LockTypeEnum.adLockOptimistic)

'Do the mail merge
'' wdapp.Documents(1).MailMerge.MainDocumentType = wdFormLetters''
wdapp.Documents(1).MailMerge.OpenDataSource Name:="",
ConfirmConversions:=False, _
''' ReadOnly:=False,
Connection:="dsn=inCITe1;uid=swb;pwd=vantive;datab ase=vantive",
LinkToSource:=True, AddToRecentFiles:=False, _
''' PasswordDocument:="", PasswordTemplate:="",
WritePasswordDocument:="", _
''' WritePasswordTemplate:="", Revert:=False,
Format:=wdOpenFormatAuto, _
''' SQLStatement:=strSQL
wdapp.Documents.Item(1).MailMerge.MainDocumentType =
Word.WdMailMergeMainDocType.wdFormLetters
wdapp.Documents.Item(1).MailMerge.OpenDataSource(N ame:="",
ConfirmConversions:=False,
ReadOnly:=False,
Connection:=strDSN,
LinkToSource:=True,
AddToRecentFiles:=False,
PasswordDocument:="",
PasswordTemplate:="",
WritePasswordDocument:="",
WritePasswordTemplate:="",
Revert:=False,
Format:=Word.WdOpenFormat.wdOpenFormatAuto, SQLStatement:=strSQL)

'"DSN=inCITe;uid=swb;pwd=Pswrd"
With wdapp.Documents.Item(1).MailMerge *=*=*=*=*=*=*=*=**=*=*=*
.SuppressBlankLines = True
.Destination = Word.WdMailMergeDestination.wdSendToNewDocument
.Execute((False))
End With

'Free Memory
strSQL = ""

'MsgBox "Mailmerge successful so far"

Exit Sub
MergeError:
' MsgBox "Check table " & adoInitialRS!swLetterHistId
Select Case Err.Number
Case 5631 'No records matched the select or they were empty
blnMergeFailed = True
Error_Logger(Err.Number, Err.Description, "Do Mail Merge")
Case 5922 'Word was unable to open the data source
Error_Logger(Err.Number, Err.Description, "Do Mail Merge")
blnMergeFailed = True
Case 462 'The ODBC Connection has been lost,
'Database server or network Connection has failed
Error_Logger(Err.Number, Err.Description, "Do Mail Merge")
blnMergeFailed = True
Close_dbConnection()
Case -2147418111 'Automation error Call was rejected by callee.
Error_Logger(Err.Number, Err.Description, "Do Mail Merge")
blnMergeFailed = True
Close_dbConnection()
Case Else
Error_Logger(Err.Number, Err.Description, "Do Mail Merge")
blnMergeFailed = True
End Select
End Sub
*************************

"Doug Robbins - Word MVP" wrote:

Not without seeing the code. (Though I am not sure that I can help with
VB.NET, but someone may be able to)

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"JeffT" wrote in message
...
Hello. I am a newbie here. I need some help.
A little history: I wrote a form letter generation system in VB 4.0 about
10
years ago and it has been used to merge data into many thousands of
letters
usin MS word 2.0.
The problem: My company now says we have to upgrade the servers and Word
for
security reasons. I have converted the VB program to VB.NET and upgraded
Word
to Microsoft Office Word 2003 (11.8202.8202) SP3. But nothing works.
The program launches correctly and connects to the Sybase database, gets
its
recordset of variables to merge and then opens Word, and Stops at the
point
the merge is supposed to take place.
Does anyone have any I dea of a setting or option that I might need to
change?
I already turned off all the options in the track changes section.
Thank you for any help,
Jeff




  #4   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Doug Robbins - Word MVP Doug Robbins - Word MVP is offline
external usenet poster
 
Posts: 8,832
Default Word 2003 Merge with Sybase Database Query as datasource.

Try it without the ((False))

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"JeffT" wrote in message
...
Doug,
Thank you for the response.
Here is the sub routine that merges the documents.
The process stops at the line with *=*=*=*=*=*=*=*=*
Any ideas would be appreciated.
No errors are returned, the process just stops.

*********************************
Public Sub Do_MailMerge(ByRef wdapp As Word.Application)

Dim adoMergeRS As ADODB.Recordset
Dim strSQL As String
On Error GoTo MergeError

strSQL = "Select * from " & tablename & " where swLetterHistId = " &
adoInitialRS.Fields("swLetterHistId").Value

adoMergeRS = New ADODB.Recordset
'Opening the recordset
adoMergeRS.Open(strSQL, dbconnection, ADODB.CursorTypeEnum.adOpenStatic,
ADODB.LockTypeEnum.adLockOptimistic)

'Do the mail merge
'' wdapp.Documents(1).MailMerge.MainDocumentType = wdFormLetters''
wdapp.Documents(1).MailMerge.OpenDataSource Name:="",
ConfirmConversions:=False, _
''' ReadOnly:=False,
Connection:="dsn=inCITe1;uid=swb;pwd=vantive;datab ase=vantive",
LinkToSource:=True, AddToRecentFiles:=False, _
''' PasswordDocument:="", PasswordTemplate:="",
WritePasswordDocument:="", _
''' WritePasswordTemplate:="", Revert:=False,
Format:=wdOpenFormatAuto, _
''' SQLStatement:=strSQL
wdapp.Documents.Item(1).MailMerge.MainDocumentType =
Word.WdMailMergeMainDocType.wdFormLetters
wdapp.Documents.Item(1).MailMerge.OpenDataSource(N ame:="",
ConfirmConversions:=False,
ReadOnly:=False,
Connection:=strDSN,
LinkToSource:=True,
AddToRecentFiles:=False,
PasswordDocument:="",
PasswordTemplate:="",
WritePasswordDocument:="",
WritePasswordTemplate:="",
Revert:=False,
Format:=Word.WdOpenFormat.wdOpenFormatAuto, SQLStatement:=strSQL)

'"DSN=inCITe;uid=swb;pwd=Pswrd"
With wdapp.Documents.Item(1).MailMerge *=*=*=*=*=*=*=*=**=*=*=*
.SuppressBlankLines = True
.Destination = Word.WdMailMergeDestination.wdSendToNewDocument
.Execute((False))
End With

'Free Memory
strSQL = ""

'MsgBox "Mailmerge successful so far"

Exit Sub
MergeError:
' MsgBox "Check table " & adoInitialRS!swLetterHistId
Select Case Err.Number
Case 5631 'No records matched the select or they were empty
blnMergeFailed = True
Error_Logger(Err.Number, Err.Description, "Do Mail Merge")
Case 5922 'Word was unable to open the data source
Error_Logger(Err.Number, Err.Description, "Do Mail Merge")
blnMergeFailed = True
Case 462 'The ODBC Connection has been lost,
'Database server or network Connection has failed
Error_Logger(Err.Number, Err.Description, "Do Mail Merge")
blnMergeFailed = True
Close_dbConnection()
Case -2147418111 'Automation error Call was rejected by callee.
Error_Logger(Err.Number, Err.Description, "Do Mail Merge")
blnMergeFailed = True
Close_dbConnection()
Case Else
Error_Logger(Err.Number, Err.Description, "Do Mail Merge")
blnMergeFailed = True
End Select
End Sub
*************************

"Doug Robbins - Word MVP" wrote:

Not without seeing the code. (Though I am not sure that I can help with
VB.NET, but someone may be able to)

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"JeffT" wrote in message
...
Hello. I am a newbie here. I need some help.
A little history: I wrote a form letter generation system in VB 4.0
about
10
years ago and it has been used to merge data into many thousands of
letters
usin MS word 2.0.
The problem: My company now says we have to upgrade the servers and
Word
for
security reasons. I have converted the VB program to VB.NET and
upgraded
Word
to Microsoft Office Word 2003 (11.8202.8202) SP3. But nothing works.
The program launches correctly and connects to the Sybase database,
gets
its
recordset of variables to merge and then opens Word, and Stops at the
point
the merge is supposed to take place.
Does anyone have any I dea of a setting or option that I might need to
change?
I already turned off all the options in the track changes section.
Thank you for any help,
Jeff






Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
CHange query/datasource mail merge is bound to Alex Mailmerge 1 September 13th 06 06:31 PM
Database Query on Merge field KarenB Mailmerge 7 April 3rd 06 05:34 PM
Mail merge macro does not find database query katescotland Mailmerge 0 September 9th 05 09:17 AM
Can I Mail Merge from SQL Database without an odc datasource? Robert Jones Mailmerge 2 June 1st 05 03:27 PM
Refreshing query with MS Access datasource fishy Microsoft Word Help 1 February 10th 05 11:30 AM


All times are GMT +1. The time now is 11:23 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"