Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Code for a Command Button to output a report to RTF

5 views
Skip to first unread message

NikkiNYCC

unread,
Apr 30, 2010, 10:01:01 AM4/30/10
to
Hi,

I have already some code pre programmed by someone many years ago which does
this, however when I try to replicate and alter this code to now output RTF
copies of reports into a folder and save I am getting the following error
message:


Run Time Error '2302';
Microsoft Office Access cant save the output data to the file you've selected.

End - Debug - Help

The code I am using is below:

Private Sub cmdQ4_Click()

Dim rpt As String
Dim strDest As String

DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70

create_a:

rpt = "rpt:Q4"
strDest = "I:\landchar\searches\NEW RTF" &
[Forms]![frm:detailsInput]![Official Search Number] & ".rtf"

DoCmd.OutputTo acOutputReport, rpt, acFormatRTF, strDest


End Sub

I have studied VBA and all 3 stages of Access but this one has me stumped.

Thanks

Nikki


Alex Dybenko

unread,
May 3, 2010, 1:11:29 AM5/3/10
to
Hi,
could be that [Forms]![frm:detailsInput]![Official Search Number] contains
characters like /\? etc, which cant be used in file names, check this.

--
Best regards,
___________
Alex Dybenko (MVP)
http://accessblog.net
http://www.PointLtd.com


"NikkiNYCC" <Nikk...@discussions.microsoft.com> wrote in message
news:C865FEDE-70D6-46B7...@microsoft.com...

0 new messages