By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,583 Members | 3,480 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,583 IT Pros & Developers. It's quick & easy.

Different Versions of Access on Same Computer

P: n/a
I have a computer with XP on it. I loaded Office 97 first because I
needed Access 97 for some work. I then loaded Office 2000.
Everything seemed to be running fine. But I have come across a few
problems.

1) I have hyperlinks in some tables and when I try to access the
hyperlinks I get an error message "An unexpected error has occurred.

2) I've been trying to do some automation through Access for MS Word
using VBA code. I've been getting an error message "Automation Error,
The server threw an exception".

I'm wondering if this is being caused by some compatibility issues
that I don't know of because caused by having two different versions
of MS Office on my computer.

So I'd greatly appreciate any information on the subject. Thanks.
Nov 12 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
Many people have multiple versions on their workstation. Did you ensure that
the two different versions were installed into different folders?

It would help if you posted the actual code that cause the errors to occur.

Michka has good advice about multiple versions at
http://www.trigeminal.com/usenet/usenet019.asp

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(No private e-mails, please)

"Ecohouse" <vi*******@netzero.com> wrote in message
news:dd**************************@posting.google.c om...
I have a computer with XP on it. I loaded Office 97 first because I
needed Access 97 for some work. I then loaded Office 2000.
Everything seemed to be running fine. But I have come across a few
problems.

1) I have hyperlinks in some tables and when I try to access the
hyperlinks I get an error message "An unexpected error has occurred.

2) I've been trying to do some automation through Access for MS Word
using VBA code. I've been getting an error message "Automation Error,
The server threw an exception".

I'm wondering if this is being caused by some compatibility issues
that I don't know of because caused by having two different versions
of MS Office on my computer.

So I'd greatly appreciate any information on the subject. Thanks.

Nov 12 '05 #2

P: n/a
Thanks for the help and information. I did install Office 97 and Office
2000 in seperate folders.

Except for the recent problems I have come across I haven't had any
trouble with my code. The problem seems to occur now because I am
trying to access different programs through Access.

Here is one example of code that I'm using. This uses automation to
open Word and create a merge document.

Public Function CreateMergeDoc(UseDDE As Boolean, PrintDoc As Boolean)

Dim WordApp As Word.Application
Dim WordDoc As Word.Document
Dim strLetter As String
Dim strConnect As String

On Error GoTo CreateMergeDoc_Error

' Create an instance of Microsoft Word 2000.
Set WordApp = CreateObject("Word.Application")

WordApp.Visible = True

' Create a new, empty document.
Set WordDoc = WordApp.Documents.Add

With WordDoc.MailMerge
If UseDDE Then
strConnect = "TABLE Customers"
Else
' Note that on your computer the path
' to Northwind.mdb may be different.

strConnect = "DSN=MS Access " _
& "Database;DBQ=C:\Office2000\Office\Samples\Northwi nd.mdb;" _
& "FIL=MS Access;"
End If
'==========================================
' This next line causes an error
'==========================================
.OpenDataSource _
Name:="C:\Office2000\Office\Samples\Northwind.mdb" , _
ReadOnly:=True, LinkToSource:=True, _
Connection:=strConnect, _
SQLStatement:="SELECT * FROM [Customers]"

' Define the Merge fields in the document.
With .Fields
.Add Range:=WordApp.Selection.Range, Name:="CompanyName"
WordApp.Selection.TypeParagraph
.Add Range:=WordApp.Selection.Range, Name:="Address"
WordApp.Selection.TypeParagraph
.Add Range:=WordApp.Selection.Range, Name:="City"
WordApp.Selection.TypeText Text:=", "
.Add Range:=WordApp.Selection.Range, Name:="Region"
WordApp.Selection.TypeText Text:=" "
.Add Range:=WordApp.Selection.Range, Name:="PostalCode"
WordApp.Selection.TypeParagraph
.Add Range:=WordApp.Selection.Range, Name:="Country"
End With
End With

' Define the body of the letter in the merge document.
strLetter = "Thank you for your business during the past year."
With WordApp.Selection
.TypeParagraph
.TypeParagraph
.TypeText Text:=strLetter
.TypeParagraph
.TypeParagraph
.TypeText Text:="Sincerely,"
.TypeParagraph
.TypeParagraph
.TypeText Text:="Northwind Traders"
End With
With WordDoc.MailMerge
' Only merge records 1-10 from the table.
.DataSource.FirstRecord = 1
.DataSource.LastRecord = 10

' Merge the data to a new document.
.Destination = wdSendToNewDocument

' Execute the mail merge.
.Execute

' If user specified to print the document, disable
' background printing, and then print the merged document.
If PrintDoc Then
.Application.Options.PrintBackground = False
.Application.ActiveDocument.PrintOut
End If
End With

' Show the instance of Microsoft Word.
WordApp.Visible = True

CreateMergeDoc_Exit:
Exit Function

CreateMergeDoc_Error:
MsgBox Err.Number & vbCrLf & Err.Description
Resume Next

End Function

To run this code you have to check where you have the Northwinds.mdb on
your computer. And type in the following in the intermediate window:
createmergedoc false, False

It returns an error message that says, "Autmation Error, The server
threw an exception". This occurs at the line:

.OpenDataSource _
Name:="C:\Office2000\Office\Samples\Northwind.mdb" , _
ReadOnly:=True, LinkToSource:=True, _
Connection:=strConnect, _
SQLStatement:="SELECT * FROM [Customers]"

The rest of the code runs fine. But I've tried different ways to access
the datasource to run the merge and none of have worked.

Although if I have already created the merge document in Word I can open
and run that. I just can't create it on the fly through code.

I've also run Excel automation with no problem. Although it always
opens Excel 97 and not Excel 2000.

If I'm in a table and I click on a hyperlink field. I get an error that
says, "An unexpected error has occurred.

I know this is a lot of information but I'm hoping that maybe you can
tell me what's going on. I just don't want to find more and more
problems down the line.

Thanks again and in advance for your time and help. It's greatly
appreciated.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 12 '05 #3

P: n/a
Not sure I'm going to be offer much assistance, as I don't do mail merges.
You're not actually using DDE, are you? You should probably remove that bit
from the code...

Albert Kallal has sample code for mail merges at
http://www.attcanada.net/~kallal.msn.../msaccess.html You might
compare what you have to his code.

To ensure a particular version of the application, by the way, specify the
version when you instantiate it.

Set WordApp = CreateObject("Word.Application.8") will get you Word 97, while
Set WordApp = CreateObject("Word.Application.9") will get you Word 2000.
--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(No private e-mails, please)

"Bruce Sherman" <vi*******@netzero.com> wrote in message
news:3f*********************@news.frii.net...
Thanks for the help and information. I did install Office 97 and Office
2000 in seperate folders.

Except for the recent problems I have come across I haven't had any
trouble with my code. The problem seems to occur now because I am
trying to access different programs through Access.

Here is one example of code that I'm using. This uses automation to
open Word and create a merge document.

Public Function CreateMergeDoc(UseDDE As Boolean, PrintDoc As Boolean)

Dim WordApp As Word.Application
Dim WordDoc As Word.Document
Dim strLetter As String
Dim strConnect As String

On Error GoTo CreateMergeDoc_Error

' Create an instance of Microsoft Word 2000.
Set WordApp = CreateObject("Word.Application")

WordApp.Visible = True

' Create a new, empty document.
Set WordDoc = WordApp.Documents.Add

With WordDoc.MailMerge
If UseDDE Then
strConnect = "TABLE Customers"
Else
' Note that on your computer the path
' to Northwind.mdb may be different.

strConnect = "DSN=MS Access " _
& "Database;DBQ=C:\Office2000\Office\Samples\Northwi nd.mdb;" _
& "FIL=MS Access;"
End If
'==========================================
' This next line causes an error
'==========================================
.OpenDataSource _
Name:="C:\Office2000\Office\Samples\Northwind.mdb" , _
ReadOnly:=True, LinkToSource:=True, _
Connection:=strConnect, _
SQLStatement:="SELECT * FROM [Customers]"

' Define the Merge fields in the document.
With .Fields
.Add Range:=WordApp.Selection.Range, Name:="CompanyName"
WordApp.Selection.TypeParagraph
.Add Range:=WordApp.Selection.Range, Name:="Address"
WordApp.Selection.TypeParagraph
.Add Range:=WordApp.Selection.Range, Name:="City"
WordApp.Selection.TypeText Text:=", "
.Add Range:=WordApp.Selection.Range, Name:="Region"
WordApp.Selection.TypeText Text:=" "
.Add Range:=WordApp.Selection.Range, Name:="PostalCode"
WordApp.Selection.TypeParagraph
.Add Range:=WordApp.Selection.Range, Name:="Country"
End With
End With

' Define the body of the letter in the merge document.
strLetter = "Thank you for your business during the past year."
With WordApp.Selection
.TypeParagraph
.TypeParagraph
.TypeText Text:=strLetter
.TypeParagraph
.TypeParagraph
.TypeText Text:="Sincerely,"
.TypeParagraph
.TypeParagraph
.TypeText Text:="Northwind Traders"
End With
With WordDoc.MailMerge
' Only merge records 1-10 from the table.
.DataSource.FirstRecord = 1
.DataSource.LastRecord = 10

' Merge the data to a new document.
.Destination = wdSendToNewDocument

' Execute the mail merge.
.Execute

' If user specified to print the document, disable
' background printing, and then print the merged document.
If PrintDoc Then
.Application.Options.PrintBackground = False
.Application.ActiveDocument.PrintOut
End If
End With

' Show the instance of Microsoft Word.
WordApp.Visible = True

CreateMergeDoc_Exit:
Exit Function

CreateMergeDoc_Error:
MsgBox Err.Number & vbCrLf & Err.Description
Resume Next

End Function

To run this code you have to check where you have the Northwinds.mdb on
your computer. And type in the following in the intermediate window:
createmergedoc false, False

It returns an error message that says, "Autmation Error, The server
threw an exception". This occurs at the line:

.OpenDataSource _
Name:="C:\Office2000\Office\Samples\Northwind.mdb" , _
ReadOnly:=True, LinkToSource:=True, _
Connection:=strConnect, _
SQLStatement:="SELECT * FROM [Customers]"

The rest of the code runs fine. But I've tried different ways to access
the datasource to run the merge and none of have worked.

Although if I have already created the merge document in Word I can open
and run that. I just can't create it on the fly through code.

I've also run Excel automation with no problem. Although it always
opens Excel 97 and not Excel 2000.

If I'm in a table and I click on a hyperlink field. I get an error that
says, "An unexpected error has occurred.

I know this is a lot of information but I'm hoping that maybe you can
tell me what's going on. I just don't want to find more and more
problems down the line.

Thanks again and in advance for your time and help. It's greatly
appreciated.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 12 '05 #4

P: n/a
In article <6Q*******************@news04.bloor.is.net.cable.r ogers.com>
"Douglas J. Steele" <NOSPAM_djsteele@NOSPAM_canada.com> wrote:

Many people have multiple versions on their workstation. Did you ensure that
the two different versions were installed into different folders?

It would help if you posted the actual code that cause the errors to occur.

Michka has good advice about multiple versions at
http://www.trigeminal.com/usenet/usenet019.asp

Also, see the several examples at
http://www.nero-online.org/lastmeasure


--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(No private e-mails, please)

"Ecohouse" <vi*******@netzero.com> wrote in message
news:dd**************************@posting.google.c om...
I have a computer with XP on it. I loaded Office 97 first because I
needed Access 97 for some work. I then loaded Office 2000.
Everything seemed to be running fine. But I have come across a few
problems.

1) I have hyperlinks in some tables and when I try to access the
hyperlinks I get an error message "An unexpected error has occurred.

2) I've been trying to do some automation through Access for MS Word
using VBA code. I've been getting an error message "Automation Error,
The server threw an exception".

I'm wondering if this is being caused by some compatibility issues
that I don't know of because caused by having two different versions
of MS Office on my computer.

So I'd greatly appreciate any information on the subject. Thanks.


-=-
This message was posted via two or more anonymous remailing services.








Nov 12 '05 #5

P: n/a
Thanks again for the help. When I use this line of code:
Set WordApp = CreateObject("Word.Application.8")

It still opens Word 2000.

I also went to the website you suggested and tried that code. It ran
but doesn't really create a merge letter on the fly which is what I'm
trying to do.

So at this pointn I have no idea what to do now. Do you have any other
ideas?

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 12 '05 #6

P: n/a
An****************@See.Comment.Header
Also, see the several examples at


Do not click on the above mentioned URL.

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Nov 12 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.