By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,631 Members | 892 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,631 IT Pros & Developers. It's quick & easy.

output report in word format not rtf

P: 41
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()

Expand|Select|Wrap|Line Numbers
  1. Dim strDocName As String
  2.     strDocName = mailing_list
  3.     DoCmd.OpenQuery "query1"
  4.  
  5.     DoCmd.OpenQuery "query2"
  6. 'Set up the objects required for Automation into lotus notes
  7.     'Set dbs = CurrentDb
  8.     Dim rst As Object
  9.     Dim rat As Object
  10.     Dim Maildb As Object 'The mail database
  11.     Dim UserName As String 'The current users notes name
  12.     Dim MailDbName As String 'THe current users notes mail database name
  13.     Dim MailDoc As Object 'The mail document itself
  14.     Dim AttachME As Object 'The attachment richtextfile object
  15.     Dim Session As Object 'The notes session
  16.     Dim EmbedObj As Object 'The embedded object (Attachment)
  17.     Dim copyTo(250) As Variant
  18.     '
  19.     Set rst = CurrentDb.OpenRecordset("mailing_list")
  20.  
  21.     With rst
  22.  
  23.         .MoveFirst      'go to the first record
  24.  
  25.         strAddress = .Fields(1).Value
  26.  
  27.          .MoveNext   'get all subsequent addresses and separate each with a semi-colon
  28.         strBcc = strAddress
  29.         Do While .EOF = False
  30.             strAddress = .Fields(1).Value
  31.             '*** Replace "EMailAddress" with the name of your field
  32.             strBcc = strBcc & ", " & strAddress
  33.             .MoveNext
  34.                     Loop
  35.     End With
  36.     Set rat = CurrentDb.OpenRecordset("email_detail_table")
  37.  
  38.     With rat
  39.  
  40.         .MoveFirst      'go to the first record
  41.  
  42.         strsbj1 = .Fields(0).Value
  43.         strsbj2 = .Fields(1).Value
  44.         strsbj3 = .Fields(2).Value
  45.         strsbj4 = .Fields(3).Value
  46.         strsbj5 = .Fields(4).Value
  47.         strsbjM = "POL" & strsbj1 & " " & strsbj2 & " " & strsbj3 & " " & strsbj4
  48.  
  49.         End With
  50.  
  51.     DoCmd.OutputTo acOutputReport, "current_form_report", acFormatTXT, "S:\BSM\System Operations Team\Live Service Team\OCP Information\POL OCP\" & "POL" & strsbj1 & ".doc", False
  52.     'Start a session to notes
  53.     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
Mar 24 '08 #1
Share this Question
Share on Google+
2 Replies


JustJim
Expert 100+
P: 407
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()

Expand|Select|Wrap|Line Numbers
  1. Dim strDocName As String
  2.     strDocName = mailing_list
  3.     DoCmd.OpenQuery "query1"
  4.  
  5.     DoCmd.OpenQuery "query2"
  6. 'Set up the objects required for Automation into lotus notes
  7.     'Set dbs = CurrentDb
  8.     Dim rst As Object
  9.     Dim rat As Object
  10.     Dim Maildb As Object 'The mail database
  11.     Dim UserName As String 'The current users notes name
  12.     Dim MailDbName As String 'THe current users notes mail database name
  13.     Dim MailDoc As Object 'The mail document itself
  14.     Dim AttachME As Object 'The attachment richtextfile object
  15.     Dim Session As Object 'The notes session
  16.     Dim EmbedObj As Object 'The embedded object (Attachment)
  17.     Dim copyTo(250) As Variant
  18.     '
  19.     Set rst = CurrentDb.OpenRecordset("mailing_list")
  20.  
  21.     With rst
  22.  
  23.         .MoveFirst      'go to the first record
  24.  
  25.         strAddress = .Fields(1).Value
  26.  
  27.          .MoveNext   'get all subsequent addresses and separate each with a semi-colon
  28.         strBcc = strAddress
  29.         Do While .EOF = False
  30.             strAddress = .Fields(1).Value
  31.             '*** Replace "EMailAddress" with the name of your field
  32.             strBcc = strBcc & ", " & strAddress
  33.             .MoveNext
  34.                     Loop
  35.     End With
  36.     Set rat = CurrentDb.OpenRecordset("email_detail_table")
  37.  
  38.     With rat
  39.  
  40.         .MoveFirst      'go to the first record
  41.  
  42.         strsbj1 = .Fields(0).Value
  43.         strsbj2 = .Fields(1).Value
  44.         strsbj3 = .Fields(2).Value
  45.         strsbj4 = .Fields(3).Value
  46.         strsbj5 = .Fields(4).Value
  47.         strsbjM = "POL" & strsbj1 & " " & strsbj2 & " " & strsbj3 & " " & strsbj4
  48.  
  49.         End With
  50.  
  51.     DoCmd.OutputTo acOutputReport, "current_form_report", acFormatTXT, "S:\BSM\System Operations Team\Live Service Team\OCP Information\POL OCP\" & "POL" & strsbj1 & ".doc", False
  52.     'Start a session to notes
  53.     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
Mar 24 '08 #2

P: 41
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
Mar 24 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.