Question Convert to Word automatically?

travismp

Registered User.
Local time
Today, 19:34
Joined
Oct 15, 2001
Messages
386
I am running Access 2003. I have a form that shows my client info, my user can click a button to load a report in print preview for that client. Works great. Is there anything I can add in the VBScript that will convert it to word instead of opening the report in print preview mode but instead as a word doc?

Here is my VB script.

Code:
Private Sub cmd_Fax_Click()
On Error GoTo Err_cmd_Fax_Click

    Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = "rep_CONTACT_FAX"
    
    stLinkCriteria = "[CompName] = """ & [Company] & """"
    DoCmd.OpenReport stDocName, acPreview, , stLinkCriteria

Exit_cmd_Fax_Click:
    Exit Sub

Err_cmd_Fax_Click:
    MsgBox Err.Description
    Resume Exit_cmd_Fax_Click
    
End Sub
 
try the super easy word function - google it
allows for full word intergration
 
Gary,

You've mentioned that several times and I've always hit a roadblock when trying to find out what you were talking about, until now (I think).

Are you referring to Albert D. Kallal's "MergeSingleWord()" function?
 
http://www.members.shaw.ca/AlbertKallal/msaccess/msaccess.html

yeah - the links above

in essence you need to get your data into 1 table and base a form on this one table (put all the fields on it and have then hidden )


what i did to get a single record is an append qry into my empty table (which the form is based on) then use the merge function) then when I exit I delete the info on the table

If you are a bit more cleverer than me (which would not be hard to do ) you might be able to do away with th e single table and figure out the coding behind it to make this work on a qry (I could n't so I used the table method instead)- you then generate a template word doc and all of the fields that are on the form (hidden or visible0 are avaibale for merging -

small draw back number formatting goes out the window - you aave to rely on word switches ( I fumble with these)
however the actual merege bit itself is pretty hot - it doesn't matter what version of word is used
 
That seems like a lot of work on the user end. Right now they launch the report with the click of a button. They can then click on the Word icon at the top which will then convert the report out of the database to a Word doc on their end. I just want to take out the one extra step of them clicking the word doc button. So my user clicks a button the VB script runs creating the report, then somehow converts it tow word. Essentially pressing the 'convert to word' button for them.
 
sure if its a simple report thats great - however if you got a really nightmare one say 10 pages long and the use of bookmarks might drive you crazy , also
you can have as many templates as you want - for me as an example

I have a cleint fax
a broker fax
a client chaser
a broker chaser
a client chaser 2
a broker chaser 2
Renewal cleint
renewal broker
renewal client chaser

marketing letter
market presentation style 1 ,2,3,4,5,
slip presentation 1,2,3,4,5,

and while these are "standard" i.e they are templates - every user will want to edit a certain section or part thereof of a report .

on my draft version of my d/b i will have system letters/reports (about 10-20)(access one) - but I know I will need at least 20 non standard reports/letter

+ marketing flyers etc promotions that can be merge out as well

- it gives a bit more flexibility in reports- as most people think word
I however prefer Access report - hard coded - complaint (buzz word in insurnace) and "unchangeable" - however I need te flexibility to be able to say 90% will be access reports - however provision for those 10% that don't fit the mold ( the type of insurance i do is not the average motor, marine type )

the supereasy word -gives more flexibility - doesn't mean it the b all and end all - its out there and the guy would built - has saved a lot of people a lot of headaches in which Microsoft should of sorted themselves - (This isn't a maon , just an opion)
 
god - how many typos in this lot... anyway off home now ..
hope this helps

regards
 
see my issue is with a simple report. I do not need to mail merge 10 total reports together all at once with tables that have hidden data that my user has to delete when finshed only after my backend system has copied over selected records. WOW...

I just want to know is there something I can add to my VB that will convert & open the report in Word instead of print preview mode?

Thank you for your help so far Gary, & I think this will help me with a bigger report issue I will tackle next week, but right now I just need this one extra line of code or help.
 
- what you asking for is way above me - need one of the real techie guy's I cna hack and put together - but your after something more than i can help

hope someone can help..

regards
 
OK, TravisMP - the short answer is you cannot "really" do exactly what you said, but yet what you CAN do is simple enough.

There is an icon in the tool bar that allows you to export a report to Word. You open the report in Access, then click this icon. Word opens up on the report, which is now in .RTF mode. You can save the report where you want using File >> Save As from the Word menu bar.

The next step after this involves creating a Word Application object, then exporting the document to Word via a sequence of DoCmd methods, then opening the Word object and pointing it to the Word document. But this is exactly what that Icon does anyway.

The next step beyond this (if a Word .RTF isn't good enough) is to open that Word Application object and write a humongous pile of code to create your Word document by executing methods to insert text in paragraphs, create Word tables and populate them, and in general assert a lot of formatting things. I know how to do it but my take is that if you don't like the .RTF, you would REALLY not like the Word document I built for you by doing it the "hard" way.
 
OK DOC so it sounds like my users will need to continue running the report then simply clicking the button. I just thought there would be a way to do that for them, but it sounds like it is going to be way too much time and effort.

THANK YOU ALL FOR THE HELP.
 
as another note - as your reports get more complicated - you will lose all formating - the word button isn't brilliant - does nice simple reports - but anything too complicated and it goes tits up..
 

Users who are viewing this thread

Back
Top Bottom