Export Access 2003 Report To Word Create Path and Open It

C

Charlie

I am trying to run then export a report to Word so that it opens on a form
button click and is editable in word.

Using my limited knowledge I can create the report but then keep on getting
a msg box asking me where I want to save the file before I can view it. I
want to avoid this message box appearing and go straight into the doc.

Thank you very much in advance.
 
N

NTC

you are just using the export to Word via the Word icon in the menu bar??

have you tried setting up the export task via a macro? in the macro your
first line can be SetWarnings with No...
 
C

Charlie

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"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top