Solved

set column widths in outlook whwn loading a query

Posted on 2016-08-30
2
30 Views
Last Modified: 2016-09-07
I have a query with 3 fields, A,B,C.  When I use DoCmd.OutputTo acOutputQuery, "QueryABC", acFormatHTML, "QABC.htm"  The C column is about half as wide as I would like it to be.  I want to automate these emails so I do not want to change it on each one.  I saw something about using a template but had no luck at all either creating or getting that to work.  How can I get this column wider?

Thanks.
0
Comment
Question by:vmccune
2 Comments
 
LVL 84

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 500 total points
ID: 41777157
You don't really have much control over this process, so there's not much you can do, and using a Template would have no impact on the content spit out from the query. That would only control the "body" and such of the HTML document you send.

The only way to do this effectively is build the table yourself, in code, using standard HTML tags. I've done this in the past, and it's not too terribly difficult. You just do something like this;

dim html As String
Dim rst As DAO.Recordset
Set rst = Currentdb.OpenRecordset("SomeQueryOrSQL")
html = "<table><tr><td>ColumnHeader1</td><td>ColumnHeader2</td></tr>"
do Until rst.EOF
  html = html & "<tr><td>" & rst("Column1") & "</td><td>" & rst("Column2") & "</td></tr>"
  rst.MoveNext
Loop
html = html " & </table>

You can size the columns in the first "row" (where the html=<table> blah blah" line is). Consult any HTML tag resource to determine the valid tag attributes you can use.
0
 

Author Comment

by:vmccune
ID: 41788911
Got just what I wanted with this as a starting block.
0

Featured Post

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In this step by step procedure, you will come to know the details of creating an Outlook meeting in 2007, 2010, 2013 & 2016.
It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question