Error in Command Button "Not Here"

duecesup

Registered User.
Local time
Today, 06:00
Joined
Nov 20, 2008
Messages
15
Hello Everyone,
This is a weird problem and I dont exactly know where to correctly post it.

I have a command button on a form that links to a word document on the server. The form is part of a front end database with forms linking to information on the back-end which is also on the server. Each system that needs to retrieve information from the database has a copy of the front-end on the desktop.

On the computer I created the access database the command button works fine. However, on the systems I copied the front end to I get an error that simply reads "Not Here" Every other command button works properly since they all retrieve information from the back-end.

Can anyone tell me what the error is in relation to? or How to fix it?

Just for kicks I am including a copy of the command button coding.
Thanks for your help.

Private Sub NAGPRA_Template_Word_Click()

Dim WordDoc As String
Dim oApp As Object

If Dir(WordDoc) = "" Then
MsgBox "Not here"

Else
Set oApp = CreateObject(Class:="Word.Application")
oApp.Visible = True

oApp.Documents.Open FileName:="I:\Collections Department\Templates\NAGPRA Template.doc"
End If

End Sub
 
Well, not sure why it works on one when not on the others because nowhere in this code do you assign a file path to WordDoc.
 
The code works well, even when I change the drive map name from I:\ to the server location //SERVER/Archcenter

Is there another way to code opening an MS Word Document that I can try to see if the error persists.

Thanks for your help
 
Well, the first thing you should do is to modify like this:
Code:
Private Sub NAGPRA_Template_Word_Click()
 
Dim WordDoc As String
Dim oApp As Object
 
WordDoc = "\\SERVER\Archcenter\\Collections Department\Templates\NAGPRA Template.doc"
 
If Dir(WordDoc) = "" Then
MsgBox "Not here"
 
Else
Set oApp = CreateObject("Word.Application")
oApp.Visible = True
 
oApp.Documents.Open WordDoc
End If
 

Users who are viewing this thread

Back
Top Bottom