T
Ted
Hi all,
I'm running an Access 2000 database...soon to be Access 2007. I'm running
code to look on our server to see if a file exists. If it doesn't it creates
the file. It works ok but for some reason at the end it opens up a dialog
box and tells me "Unable to open [filename]. The hyperlink cannot be
followed to the destination." if the file has to be created Why when I run
this to I get that dialog box at the end? Any help would be very much
appreciated. I'm stumped.
Dim Response, objWord
On Error GoTo Err_cmdNewLossAssignment_Click
If Len(Dir("L:/CLAIMS/NewLossAssignments/" &
Forms![frmRCAClaims]![1#_CLM#] & "NLA.doc")) > 0 Then
cmdNewLossAssignment.HyperlinkAddress =
"L:/CLAIMS/NewLossAssignments/" & Forms![frmRCAClaims]![1#_CLM#] & "NLA.doc"
Else
Response = (MsgBox("There were no New Loss Assignments found
associated with this Claim. Would you like to create a New Loss Assignment
called " & Forms![frmRCAClaims]![1#_CLM#] & "NLA.doc?", 4, "No file found"))
If Response = vbYes Then
Set objWord = CreateObject("Word.Application")
objWord.Application.Visible = True
objWord.Documents.Add
CODE
objWord.ActiveDocument.SaveAs
filename:="L:/CLAIMS/NewLossAssignments/" & Forms![frmRCAClaims]![1#_CLM#] &
"NLA.doc"
Set objWord = Nothing
End If
End If
Exit_cmdNewLossAssignment_Click:
Exit Sub
Err_cmdNewLossAssignment_Click:
MsgBox Err.Description
Resume Exit_cmdNewLossAssignment_Click
End Sub
I'm running an Access 2000 database...soon to be Access 2007. I'm running
code to look on our server to see if a file exists. If it doesn't it creates
the file. It works ok but for some reason at the end it opens up a dialog
box and tells me "Unable to open [filename]. The hyperlink cannot be
followed to the destination." if the file has to be created Why when I run
this to I get that dialog box at the end? Any help would be very much
appreciated. I'm stumped.
Dim Response, objWord
On Error GoTo Err_cmdNewLossAssignment_Click
If Len(Dir("L:/CLAIMS/NewLossAssignments/" &
Forms![frmRCAClaims]![1#_CLM#] & "NLA.doc")) > 0 Then
cmdNewLossAssignment.HyperlinkAddress =
"L:/CLAIMS/NewLossAssignments/" & Forms![frmRCAClaims]![1#_CLM#] & "NLA.doc"
Else
Response = (MsgBox("There were no New Loss Assignments found
associated with this Claim. Would you like to create a New Loss Assignment
called " & Forms![frmRCAClaims]![1#_CLM#] & "NLA.doc?", 4, "No file found"))
If Response = vbYes Then
Set objWord = CreateObject("Word.Application")
objWord.Application.Visible = True
objWord.Documents.Add
CODE
objWord.ActiveDocument.SaveAs
filename:="L:/CLAIMS/NewLossAssignments/" & Forms![frmRCAClaims]![1#_CLM#] &
"NLA.doc"
Set objWord = Nothing
End If
End If
Exit_cmdNewLossAssignment_Click:
Exit Sub
Err_cmdNewLossAssignment_Click:
MsgBox Err.Description
Resume Exit_cmdNewLossAssignment_Click
End Sub