Word2000 / Access2000 runtime problem 
Author Message
 Word2000 / Access2000 runtime problem

I have a Word 2000 macro that works as planned on a PC with a Office 2000
installed. The macro retrieves data from an Access 2000 database.

When the same macro is run on a PC with Office 2000 SBE, and a runtime
version of Access 2000 I have errors on the line "Set wrdObj =
GetObject(GetPathToPCVetData)
". The error # is -2147023181 and is described as an Automation error.

Each of the PC's have exactly the same references within Word 2000.

The macros are shown below.

Any assistance with this would be greatly appreciated

Mike

''Start of code

Private Sub Document_New()
On Error GoTo DocErr
Dim wrdObj As Object
Dim oDoc As Word.Document
Dim nameIDStr As String
Dim dbs As Database
Dim qdf As QueryDef
Dim rst As Recordset

Set wrdObj = GetObject(GetPathToPCVetData) 'this is where the error
Set oDoc = ActiveDocument

Set dbs = CurrentDb
Set qdf = dbs.QueryDefs("CurrPerson")

qdf.Parameters![CurrPersonID] = GetCurrentPerson
Set rst = qdf.OpenRecordset

oDoc.Bookmarks("Label").Select
Selection.Text = rst!Label

oDoc.Bookmarks("Date").Select
Selection.Text = Format(Date, "dd-mmm-yyyy")

oDoc.Bookmarks("Title2").Select
Selection.Text = rst!Title

oDoc.Bookmarks("SName2").Select
Selection.Text = rst!SName

ClearVar:
rst.Close
qdf.Close
dbs.Close

Set dbs = Nothing
Set rst = Nothing
Set oDoc = Nothing
Set wrdObj = Nothing

Exit Sub
DocErr:
Select Case Err.Number
Case Else
    MsgBox "The following error occurred while checking the data for your
letter." & vbCrLf & vbCrLf & Err.Number & " " & Err.Description, vbCritical,
"Letter Error"
End Select
GoTo ClearVar

End Sub

Private Function GetPathToPCVetData() As String
Dim strProgramName As String
Dim strSection As String
Dim strValue As String
On Error GoTo PathErr

strProgramName = "PCVet-Specialist"
strSection = "Settings"
strValue = "PathToData"
GetPathToPCVetData = GetSetting(strProgramName, strSection, strValue, "File
not found")
Exit Function
PathErr:
Select Case Err.Number
Case Else
    MsgBox Err.Number & " " & Err.Description
End Select
    GetPathToPCVetGui = "File not found"
Exit Function
End Function

Private Function GetCurrentPerson() As String
Dim strProgramName As String
Dim strSection As String
Dim strValue As String
On Error GoTo PathErr

strProgramName = "PCVet-Specialist"
strSection = "Settings"
strValue = "CurrPersonID"
GetCurrentPerson = GetSetting(strProgramName, strSection, strValue, "Person
not found")

Exit Function
PathErr:
Select Case Err.Number
Case Else
    MsgBox Err.Number & " " & Err.Description
End Select
    GetCurrentPerson = "Person not found"
Exit Function
End Function



Tue, 02 Apr 2002 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Access2000/Word2000 Automation Print Hangs

2. err:462 troubles with word2000 and access2000

3. Challenging: transfer Access2000-objects into Word2000

4. problem converting ibm rftdca to word2000 .rtf format

5. Macro problem in word97 with word2000 document

6. Data format problem Word97=>Word2000

7. table problem with word2000

8. Problem with word2000 on winME

9. please help me word2000 table problem

10. a VBA problem in Word2000!?

11. Update fields in header problem in word2000

12. A VBA problem in word2000

 

 
Powered by phpBB® Forum Software