Solved

set column widths in outlook whwn loading a query

Posted on 2016-08-30
2
25 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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Resolve DNS query failed errors for Exchange
Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

706 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now