473,325 Members | 2,608 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 software developers and data experts.

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()

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
2 4106
JustJim
407 Expert 256MB
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
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

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

Similar topics

1
by: Anne | last post by:
Hi NG I have made a report in access, and i have used the OutPutTo to transfer it to word (rft format). It is a letter with addressheader, date, sign etc. The user should always add something in...
5
by: Mal | last post by:
Hi, I have a button on a form that outputs a report to word. While it has been working well for a while, today it is not. The behaviour now is that it endlessly outputs pages to word. There...
15
by: Mark C | last post by:
All, I have exhaustingly been looking through the newsgroups in search of a way to systemically output an Access 97 report to a pdf file using the full version of Adobe Acrobat. I want the user...
3
by: Jorge Cecílio | last post by:
Hi! I would like to export some MS-Access reports output to pdf. However, the only possibility offered by Access (afaik) for me to export formatted output is snp (snapshot) (I use MS-Office...
4
by: Trevor Best | last post by:
I have a report that's fairly simple, page headers and footers, detail has a subreport in (can vary in length). The customer wanted a signature block for them, their client and 3rd party. This was...
2
by: Galina | last post by:
Hello All of a sudden I started getting error 13, type mismatch in a command, which was running happily for years. Here is a code: Option Compare Database Option Explicit Dim CmdClose1_Clicked...
11
by: Ryan | last post by:
I am writing a VB (2005) program that will allow the user to fill out and print a form. The form input is stored in a database (SQL 2005) to be retrieved/viewed/printed later. The form is...
3
by: pv1 | last post by:
Hello, I am somewhat new to Access and vba, but am trying to complete a request that has been made of me. Access version 2002 WindowsXP. At this point these text boxes are bound to the table...
10
by: sara | last post by:
Hi - I have a report that is 14 columnar sub-reports (Line up: Position- holders in each of our 14 locations - Manager, Assistant Manager, Receiving, Office, etc). I output directly to PDF...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.