output report in word format not rtf

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jambonjamasb
    New Member
    • Jan 2008
    • 41

    output report in word format not rtf

    Hi I have written code to output a report and add to lotus notes and send.

    The only problem is that when the report output rich text, so i lose all the details like checkboxes, field boxes, logo etc.

    I have used the following code.

    Code: ( vb )

    Public Function SendNotesMail()

    Code:
    Dim strDocName As String
        strDocName = mailing_list
        DoCmd.OpenQuery "query1"
        
        DoCmd.OpenQuery "query2"
    'Set up the objects required for Automation into lotus notes
        'Set dbs = CurrentDb
        Dim rst As Object
        Dim rat As Object
        Dim Maildb As Object 'The mail database
        Dim UserName As String 'The current users notes name
        Dim MailDbName As String 'THe current users notes mail database name
        Dim MailDoc As Object 'The mail document itself
        Dim AttachME As Object 'The attachment richtextfile object
        Dim Session As Object 'The notes session
        Dim EmbedObj As Object 'The embedded object (Attachment)
        Dim copyTo(250) As Variant
        '
        Set rst = CurrentDb.OpenRecordset("mailing_list")
    
        With rst
            
            .MoveFirst      'go to the first record
            
            strAddress = .Fields(1).Value
            
             .MoveNext   'get all subsequent addresses and separate each with a semi-colon
            strBcc = strAddress
            Do While .EOF = False
                strAddress = .Fields(1).Value
                '*** Replace "EMailAddress" with the name of your field
                strBcc = strBcc & ", " & strAddress
                .MoveNext
                        Loop
        End With
        Set rat = CurrentDb.OpenRecordset("email_detail_table")
    
        With rat
            
            .MoveFirst      'go to the first record
            
            strsbj1 = .Fields(0).Value
            strsbj2 = .Fields(1).Value
            strsbj3 = .Fields(2).Value
            strsbj4 = .Fields(3).Value
            strsbj5 = .Fields(4).Value
            strsbjM = "POL" & strsbj1 & " " & strsbj2 & " " & strsbj3 & " " & strsbj4
            
            End With
            
        DoCmd.OutputTo acOutputReport, "current_form_report", acFormatTXT, "S:\BSM\System Operations Team\Live Service Team\OCP Information\POL OCP\" & "POL" & strsbj1 & ".doc", False
        'Start a session to notes
        Set Session = CreateObject("Notes.NotesSession")
    the line in question is 51. I have tried acFormatTXT and acFormatDOC and acFormatRTF in each functions i lose all my boxes etc any help please as the report looks garbage. I know there is a way round this as other firms use access to send automated reports, but i cant figure it out. I have tried microsoft who say tough titties and i googled it hundred of times help me please
  • JustJim
    Recognized Expert Contributor
    • May 2007
    • 407

    #2
    Originally posted by jambonjamasb
    Hi I have written code to output a report and add to lotus notes and send.

    The only problem is that when the report output rich text, so i lose all the details like checkboxes, field boxes, logo etc.

    I have used the following code.

    Code: ( vb )

    Public Function SendNotesMail()

    Code:
    Dim strDocName As String
        strDocName = mailing_list
        DoCmd.OpenQuery "query1"
        
        DoCmd.OpenQuery "query2"
    'Set up the objects required for Automation into lotus notes
        'Set dbs = CurrentDb
        Dim rst As Object
        Dim rat As Object
        Dim Maildb As Object 'The mail database
        Dim UserName As String 'The current users notes name
        Dim MailDbName As String 'THe current users notes mail database name
        Dim MailDoc As Object 'The mail document itself
        Dim AttachME As Object 'The attachment richtextfile object
        Dim Session As Object 'The notes session
        Dim EmbedObj As Object 'The embedded object (Attachment)
        Dim copyTo(250) As Variant
        '
        Set rst = CurrentDb.OpenRecordset("mailing_list")
    
        With rst
            
            .MoveFirst      'go to the first record
            
            strAddress = .Fields(1).Value
            
             .MoveNext   'get all subsequent addresses and separate each with a semi-colon
            strBcc = strAddress
            Do While .EOF = False
                strAddress = .Fields(1).Value
                '*** Replace "EMailAddress" with the name of your field
                strBcc = strBcc & ", " & strAddress
                .MoveNext
                        Loop
        End With
        Set rat = CurrentDb.OpenRecordset("email_detail_table")
    
        With rat
            
            .MoveFirst      'go to the first record
            
            strsbj1 = .Fields(0).Value
            strsbj2 = .Fields(1).Value
            strsbj3 = .Fields(2).Value
            strsbj4 = .Fields(3).Value
            strsbj5 = .Fields(4).Value
            strsbjM = "POL" & strsbj1 & " " & strsbj2 & " " & strsbj3 & " " & strsbj4
            
            End With
            
        DoCmd.OutputTo acOutputReport, "current_form_report", acFormatTXT, "S:\BSM\System Operations Team\Live Service Team\OCP Information\POL OCP\" & "POL" & strsbj1 & ".doc", False
        'Start a session to notes
        Set Session = CreateObject("Notes.NotesSession")
    the line in question is 51. I have tried acFormatTXT and acFormatDOC and acFormatRTF in each functions i lose all my boxes etc any help please as the report looks garbage. I know there is a way round this as other firms use access to send automated reports, but i cant figure it out. I have tried microsoft who say tough titties and i googled it hundred of times help me please
    Hi,
    From the Access help file for "OutputTo"
    For a control bound to a Yes/No field (a toggle button, option button, or check box), the output file displays the value –1 (Yes) or 0 (No).
    I think what you will have to do is design the report in Design view then open it based on a recordset/query that you build in code. You could then use the "SendObject " action.

    Jim

    Comment

    • jambonjamasb
      New Member
      • Jan 2008
      • 41

      #3
      Originally posted by JustJim
      Hi,
      From the Access help file for "OutputTo"

      I think what you will have to do is design the report in Design view then open it based on a recordset/query that you build in code. You could then use the "SendObject " action.

      Jim

      I have designed the report but i do not understand what u mean. I use the send to function to send the report to lotus notes. the problem I have is with how the report outputs itself it doesnt recognise DOC command and sends it a RTF which gets rid of all the actual true formating. Could u explain further what u mean?

      Does it matter if the report doesn't open before it outputs it, I run a query to return the report, which it then saves to a destination folder using a string to poulate the name, so i am confused by what u mean when u say open the recordset and sendto

      Comment

      Working...