NTC,
Thank you for your help, it is always good to know that someone who has
never met you is glad to offer their advice. There should be more people like
you. I have solved the problem now having resorted to the tried and tested
coffee and cigarettes method.
This seems to work:
Private Sub cmdWord_Click()
On Error GoTo Err_cmdWord_Click
Dim stDocName As String
Dim stDocName1 As String
stDocName = Me.lstlettertypes.Column(2)
stDocName1 = Me.lstlettertypes.Column(1)
If Me.lstlettertypes.Column(2) = "DiaryReport" Then
MsgBox "You Can Not Edit The Diary Report", , "Error"
Else
If Dir$("c:\" & Forms!frmCompQuestionnaire.ocName & "\") = "" Then
MsgBox "This Is The First Letter To This File", , "Message"
MkDir "c:\" & Forms!frmCompQuestionnaire.ocName & "\"
DoCmd.OutputTo acReport, stDocName, acFormatRTF,
Forms!frmCompQuestionnaire.ocName & "\" & stDocName1 & ".rtf", True,
stDocName, True
Else
If Dir$("c:\" & Forms!frmCompQuestionnaire.ocName & "\" & stDocName1 &
".rtf") = "" Then
MsgBox "Other Letters Have Been Issued To This File", , "Message"
DoCmd.OutputTo acReport, stDocName, acFormatRTF,
Forms!frmCompQuestionnaire.ocName & "\" & stDocName1 & ".rtf", True,
stDocName, True
Else
MsgBox "You Have Already Issued This Letter", , "Error"
End If
End If
End If
Exit_cmdWord_Click:
Exit Sub
Err_cmdWord_Click:
'MsgBox Err.Description
MsgBox "You Have Already Issued This Letter", , "Error"