Visual Basic/output to word doc
Expert: Richard Rost - 9/3/2009
QuestionQUESTION: Hi, I have asked a questions before, and you need to know the access version. the access I use is 2003.
below is my original questions
I am being asked to create this database that not only able to store the data for future reference as well as output to Word document with specific layout.
Current I have created two tables and queries for two sections of the report. First table contains multiples fields that require user to enter order no, project name, project description etc. some fields are just simple data; others are more like a memo type. The second table is reference which has reference number, edition and description. Since multiple reference doc. can apply to same order number, that’s why I create another table for it.
Currently I have used the report wizard to generate a desire report layout for print and preview. The layout contains tables to sectionalize the project info, reference etc; in addition, bullet is also hoping to help make the report easier to read. The layout of the report looks good, however, when I output to word, it is in rtf format so it can only output the text which I don’t want to. I am trying to use VB to output the report to word with table and formats, but I don’t know how to do it.
All I can think of is to create a template and have data field output to the corresponding section. But I am not quite familiar with VB, recordset etc. I don’t know how to output one specific order number and output one field at a time to section I assign. My Goal is to output report with specific order number which user request.
Do you have any better suggestion? Can guide me through this process?
One last question, is it possible to show bullet on a textbox while user is entering info?
Thanks in advance.
ANSWER: Before I go into too much detail, what is the REASON why you want to output the report as a Word Doc? Do you want the user to make edits and changes, or is this just for them to read? If it's to READ, then I would recommend exporting as a PDF file, which will look much closer to the original Report than a DOC file will.
Let me know if you have any other questions or comments.
Also, be sure to visit my FREE Tips & Tricks Page at
http://www.599cd.com/tips?key=AllExperts
Cordially,
Richard Rost
599CD Computer Training
http://www.599cd.com
P.S. Try one of my FREE tutorials at
http://www.599cd.com/VB?key=AllExperts
P.P.S. I volunteer my time at AllExperts to help people, and I get a LOT of questions, so I can't take an hour to answer each question. If you need more DETAILED HELP, come to my TechHelp web site at
http://www.599cd.com/TechHelp/AllExperts and I'll take as much time as you need to answer your question.
Are you out of work and looking for a new job (or know someone who is), but find that everyone who is hiring is looking for someone with computer skills? You're not alone. It's hard to find a job without knowing how to use a computer.
In today's offices, you need to understand how to use Microsoft Windows, write a document in Microsoft Word, or even work with spreadsheets in Microsoft Excel. Unfortunately, classroom-based computer training can be expensive - sometimes hundreds of dollars a day. If you're out of work, it's hard to afford!
I want to do my part to help people in this tough economy. I have put together a special training CD that includes over six hours of video tutorials that I'm giving away absolutely FREE to anyone who's currently out of work and looking for a job. If this describes you, click here:
http://www.599cd.com/JobSkills?key=AllExperts
---------- FOLLOW-UP ----------
QUESTION: I need to export it to a word for other people to edit. Can you show me how to do it
AnswerIn a nutshell, set up the report that you want to export to Word. Use minimal formatting because most of it won't copy through well to Word.
Now, if you want to be able to select a specific customer, then on your customer form, make a button that opens up the Report you're exporting and shows JUST the current customer record. You can do this with either a query criteria, or in your VBA code:
Docmd.OpenReport "ReportName",,"CustomerID=" & CurrentCustomerID
If you don't know how to do this, then see my Access 204 tutorial where I cover it:
http://599cd.com/site/courselist/access/access204/?key=AllExperts
Once you've got that done, you can use the Docmd.Output command to export your report as a Word document.
Let me know if you have any other questions or comments.
Also, be sure to visit my FREE Tips & Tricks Page at
http://www.599cd.com/tips?key=AllExperts
Cordially,
Richard Rost
599CD Computer Training
http://www.599cd.com
P.S. Try one of my FREE tutorials at
http://www.599cd.com/VB?key=AllExperts
P.P.S. I volunteer my time at AllExperts to help people, and I get a LOT of questions, so I can't take an hour to answer each question. If you need more DETAILED HELP, come to my TechHelp web site at
http://www.599cd.com/TechHelp/AllExperts and I'll take as much time as you need to answer your question.
Are you out of work and looking for a new job (or know someone who is), but find that everyone who is hiring is looking for someone with computer skills? You're not alone. It's hard to find a job without knowing how to use a computer.
In today's offices, you need to understand how to use Microsoft Windows, write a document in Microsoft Word, or even work with spreadsheets in Microsoft Excel. Unfortunately, classroom-based computer training can be expensive - sometimes hundreds of dollars a day. If you're out of work, it's hard to afford!
I want to do my part to help people in this tough economy. I have put together a special training CD that includes over six hours of video tutorials that I'm giving away absolutely FREE to anyone who's currently out of work and looking for a job. If this describes you, click here:
http://www.599cd.com/JobSkills?key=AllExperts