code output report rtf
Microsoft Office TrainingThe UK's Number 1 for Microsoft Office Training Sitemap add this page to your favourites/bookmarksBookmark page
 
view a printable version of this pagePrintable version
Plus One Google
Customer: Sign in
Delegate: Sign in
Trainer: Log in

Forum home » Delegate support and help forum » Microsoft Access VBA Training and help » Code to Output a report as RTF

Code to Output a report as RTF

resolvedResolved · Urgent Priority · Version 2003

replyReplyFri 30 Apr 2010, 15:05Delegate Nicola said...

Code to Output a report as RTF

Hi,

I am editing a database that was created by a previous member of staff.

I need to have a command button when clicked output a report in RTF format and save it in a form, I have the code and it keeps displaying a message that it cannot save to the specified location, but there is already code within the system that saves other reports to that location.

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 tried the debugger, but cannot work out how to make it work!
This system is supposed to be running after the bank holiday and I cannot see it happening at the moment

Any help or advice would be greatly appreciated.

Nikki

For upcoming training course dates see: Pricing & availability

replyReplySun 2 May 2010, 20:26Trainer Anthony said...

RE: Code to Output a report as RTF

Hi Nicola thanks for your query. The first element of your concatenated string strDest is:

"I:\landchar\searches\NEW RTF"

...and you're going to need another backslash after NEW RTF otherwise the rest of the text will be bolted straight onto that folder name, thereby pointing the computer at a destination that doesn't exist and causing the error you are encountering. Try putting the backslash in and see if it helps.

All the best,

Anthony

replyReplyTue 4 May 2010, 09:30Delegate Nicola said...

RE: Code to Output a report as RTF

Anthony,

Thanks, that worked great, the only problem I have with it now is that it is reportng every entry in the database (at the moment its only 100 or so).

I have gone over the code and cannot see a way to make it only report the current record.

Thanks

Nikki

replyReplyMon 10 May 2010, 15:18Trainer Anthony said...

RE: Code to Output a report as RTF

Hi Nikki, difficult to advise you on this one without seeing the source files, but you might need to put any extra line of code in to go to the last record and report on only that. What that code looks like depends a lot on the nature of your database, but you might want to run a query, extract the latest record and run your VBA on that.

Hope this helps,

Anthony

Mon 17 May 2010: Automatically marked as resolved.

 

 

Please browse our web site to find out more about
microsoft database training and other Microsoft training courses.

Access tip:

Random sampling

Data is th key to a good database, therefore checking is essential.

A good way of checking data is by random sampling. You can do this in a query, by typing the follow:
1) In the Field box create a RandonID field eg. Randon Id: Rnd(fieldname])

2) sort the field
3)Right click and chage the properties for To value to be the number of randon records you want to see.

4) Change the set to Show row for Randon ID to be False, add all the other fields you want to see and the run the query.

View all Access hints and tips

forum postHow can I protect the code written in VBA from the user accessing or modifying it?Are there any password controls?

» Forum post: Excel VBA - code protection from users


Rate this page:
2.2/5 (213 votes cast)
Accredited Training Provider: Institute of IT Training Institute of Leadership and Management - Certified Courses
Microsoft Certified Partner
Security Seal verified by visa, mastercard securecard

Mini sitemap. These are the main areas of our web site. Full sitemap.

Management training

Professional Skills courses
Project Management Course London
Project Management Courses London
Project Management Training London
Project Management Training
Project Seminar
Project Seminars
Time Management Course London
Time Management London
Time Management Courses London
Time Management Training London
Introduction to Finance course
Assertiveness Skills course
Effective Communications Skills training
Presentation Skills London

Training Formats

Public scheduled courses
On-site training
Closed company courses

Consultancy
Application Development

Blogs

Excel Training
MS Project Training
Microsoft Training Blog

Version differences

Office 2010 vs 2007
MS Project version differences

Training Information

London Computer Training
Computer Training London
Docklands Training Courses
Docklands Training London

Training venues London
Client list
FAQ
Pricing and availability
Course details / Syllabus

Training Articles
Training Information

Microsoft training

Microsoft Office training
& IT Applications

Microsoft Project training
Microsoft Outlook training
Microsoft Powerpoint training
Microsoft Word training
MS Project courses
MS Project training
Outlook courses
PowerPoint courses
PowerPoint training
VBA courses
Word courses
Microsoft.training
(more...)

Excel Training

Excel courses
Excel Training Courses Medway
Autonumber in Excel
Microsoft Excel training
Basic Excel Courses
Basic Excel Course
Basic Excel Training

Interested in MS Access training?

Access courses
Microsoft Access training
Microsoft access courses
Microsoft training access course
Microsoft+access+training
Access courses in london

Training provider

Training providers
IT training companies
IT training providers
Management Training providers
Management Training provider

Event history, feedback results
Events in 2012 · 2011 · 2010 · More

See also

Crystal Reports training