export form to word

niki

axes noob 'll b big 1 day
Local time
Today, 17:06
Joined
Apr 17, 2003
Messages
66
Pease HELP!!! export to Word problem

Hello, the code below allows me to open on a separate form one entry of a table with the use of cascading filters.
Code:
Private Sub Commande31_Click()
DoCmd.OpenReport "rptCordisDetails", A_PREVIEW
Dim strSQL2 As String
Dim intCounter As Integer
 
     'Build SQL String
     For intCounter = 1 To 2
       If Me("Filter" & intCounter) <> "" Then
         strSQL2 = strSQL2 & "[" & Me("Filter" & intCounter).Tag & "] " & " = " & Chr(34) & Me("Filter" & intCounter) & Chr(34) & " And "
       Else
       
       End If
     Next
    
 'special provision for reliability
 
 If Me("Filter" & intCounter) <> "" Then
  strSQL2 = strSQL2 & "[" & Me("Filter" & intCounter).Tag & "] " & Me("Filter" & intCounter) & " And "
     End If
     
     If strSQL2 <> "" Then
        'Strip Last " And "
        strSQL2 = left(strSQL2, (Len(strSQL2) - 5))
        'Set the Filter property
        Reports![rptCordisDetails].Filter = strSQL2
        Reports![rptCordisDetails].FilterOn = True

     Else
        Reports![rptCordisDetails].FilterOn = False
     End If

End Sub

How could I have a similar code to this one, which would export the same result to a word document, instead of opening it in a report like above?

Thanks
nico
 
Last edited:
Travis,
this tutorial explains how to send a word document to multiple recipients whose emails are contained in the original database.

What I want to do is export a report displaying the values from a table. I manage to manually export the totality of my reports.

But what I want to do is to export on a click only the filtered reports with the given code. The results of my filter is the strSQL2 string, and I want my "Export" button on the form to take that value and export the chosen report(s) to a word document.

Did I make myself clearer? I don't think so!

Ask me for more details if you want...

cheers
nico
 
example

Travis,

here's my table, with the form, and the two reports.
The first one (rptCustomers) helps me to view the totality of the macthes, and the second one (rptCordisDetails) a more detailed description of each match appearing on the first one.

What I wanna do is have a button which exports the chosen report to a word file. Is this too much of a hassle?

I appreciate your help!

cheers
nico
PS: due to compression problem and to meet the maximum size requirements, I zipped a winrar archive of my mdb. Quite unuseful but its still there!
 

Attachments

I'm very unclear of what you are trying to do.


Are you trying to create a Word Document from a report?

Or

Are you trying to use "Word" to create the Report?

Maybe a Step-By-Step of what you want accomplished may be needed.
 
Travis,

I am trying to create a Word Document from a report.
Sorry to be so unclear hope the attached example helps!

My idea of the thing is: like my details button on the form, I want to use a button which will automatically create a word file of the viewed record (for instance Reports![rptCordisDetails].Filter = strSQL2) selected with the filters.

Is it better?

I appreciate your help.

cheers
nico
 
Use the Docmd.OutputTo function:

Code:
DoCmd.OutputTo acOutputReport, "rptName", acFormatRTF, "fileName", True

You will need to move the Filter code that you have to the the Reports Open Event. (you will need to change the ME to Forms![FormName]
 
Thanks travis thought it was harder than that it works fine!
It avoids the exportation of all the reports to word!

Just wot I wanted!

I really appreciate you helping me!

cheers
nico
 

Users who are viewing this thread

Back
Top Bottom