Hi all,
I want the user to be able to click on a cmd button and the Access DB will generate a report and then export/open it in a word document
...like creating a template.
The code I have tried for the cmd button is as follows:
It give me the error invalid or unqualified reference...
Any help would really be greatly appreciated
Kind regards
Triacona
Well, I solved it while writing this question.
the answer is
Thanks for a great forum!! ![[bigsmile] [bigsmile] [bigsmile]](/data/assets/smilies/bigsmile.gif)
Kind regards
Triacona
I want the user to be able to click on a cmd button and the Access DB will generate a report and then export/open it in a word document
...like creating a template.
The code I have tried for the cmd button is as follows:
Code:
Private Sub Report_Click()
On Error GoTo Err_Report_Click
Dim stDocName As String
stDocName = "ChsRef"
DoCmd.OpenReport stDocName, acPreview
DoCmd.OutputTo acOutputReport, stDocName, doc, Template
Exit_Report_Click:
Exit Sub
Err_Report_Click:
MsgBox Err.Description
Resume Exit_Report_Click
End Sub
Any help would really be greatly appreciated
Kind regards
Triacona
Well, I solved it while writing this question.
the answer is
Code:
Private Sub Report_Click()
On Error GoTo Err_Report_Click
Dim stDocName As String
stDocName = "ChsRef"
DoCmd.OpenReport stDocName, acPreview
DoCmd.OutputTo acOutputReport, stDocName
Exit_Report_Click:
Exit Sub
Err_Report_Click:
MsgBox Err.Description
Resume Exit_Report_Click
End Sub
![[bigsmile] [bigsmile] [bigsmile]](/data/assets/smilies/bigsmile.gif)
Kind regards
Triacona
Thought is often the best solution.![]()