S
S Jackson
I have a database that is stored on our LAN that is accessed by three
different users.
In the database I have a form that contains a button that has the following
OnClick Event:
Dim objWord As Object
'Open Microsoft Word using automation
Set objWord = New Word.Application
objWord.Documents.Add "M:\LTCR\Legal\FormLetter.dot"
objWord.Visible = True
'The Following code is generated from your access form while it is
manipulating an instance of Word.
'So, while it looks somewhat live VBA, it's really Word VBA.
Line1: objWord.ActiveDocument.Bookmarks("Representative").Range.Text =
Me!Representative
Line2: objWord.ActiveDocument.Bookmarks("RepAddy").Range.Text =
Me!RepAddress
Line3: objWord.ActiveDocument.Bookmarks("Case").Range.Text = Me!CaseName
Line4: objWord.ActiveDocument.Bookmarks("DHSNo").Range.Text = Me!DHSNo
If IsNull(Me!RepFax) Then
objWord.ActiveDocument.Bookmarks("Fax").Range.Text = ""
Else
objWord.ActiveDocument.Bookmarks("Fax").Range.Text = "VIA FACSIMILE " &
Me!RepFax
End If
End Sub
**********
As you can see Word is suppose to start and open up a template called
"FormLetter" which is stored on the same drive as the database (the LAN
drive, M:, that all three users have access too) and collect specific
information from Access and put it into the Word template called FormLetter.
This function works beautifully for me on my machine and I also happen to be
the one that designed the template and stored it out on the Lan - M: drive.
However, when another user at a different work station clicks the button we
get an error. On Debug the line, "objWord.Documents.Add
"M:\LTCR\Legal\FormLetter.dot" is highlighted. Why is the code stopping
here? The path to the template FormLetter is correct and the user has
access to the M:drive (remember the database itself is also stored under the
same path).
Any help would be greatly appreciated. Thank you.
different users.
In the database I have a form that contains a button that has the following
OnClick Event:
Dim objWord As Object
'Open Microsoft Word using automation
Set objWord = New Word.Application
objWord.Documents.Add "M:\LTCR\Legal\FormLetter.dot"
objWord.Visible = True
'The Following code is generated from your access form while it is
manipulating an instance of Word.
'So, while it looks somewhat live VBA, it's really Word VBA.
Line1: objWord.ActiveDocument.Bookmarks("Representative").Range.Text =
Me!Representative
Line2: objWord.ActiveDocument.Bookmarks("RepAddy").Range.Text =
Me!RepAddress
Line3: objWord.ActiveDocument.Bookmarks("Case").Range.Text = Me!CaseName
Line4: objWord.ActiveDocument.Bookmarks("DHSNo").Range.Text = Me!DHSNo
If IsNull(Me!RepFax) Then
objWord.ActiveDocument.Bookmarks("Fax").Range.Text = ""
Else
objWord.ActiveDocument.Bookmarks("Fax").Range.Text = "VIA FACSIMILE " &
Me!RepFax
End If
End Sub
**********
As you can see Word is suppose to start and open up a template called
"FormLetter" which is stored on the same drive as the database (the LAN
drive, M:, that all three users have access too) and collect specific
information from Access and put it into the Word template called FormLetter.
This function works beautifully for me on my machine and I also happen to be
the one that designed the template and stored it out on the Lan - M: drive.
However, when another user at a different work station clicks the button we
get an error. On Debug the line, "objWord.Documents.Add
"M:\LTCR\Legal\FormLetter.dot" is highlighted. Why is the code stopping
here? The path to the template FormLetter is correct and the user has
access to the M:drive (remember the database itself is also stored under the
same path).
Any help would be greatly appreciated. Thank you.