Format Output to Word From Listbox

  • Thread starter Jeff via AccessMonster.com
  • Start date
J

Jeff via AccessMonster.com

I have a button that sends the selected items of the listbox to a word
document. But I don't know how to format the data in the word document.
Right now, it's just a dump of the data from the listbox.

How can I format the below to have bold cust id, cust name and and then
place a bold line to separate and place notes after the line....

Customer ID: ABC
Customer Name: ABC
__________________________

Notes:
xxxxxxxxxxxxxx

So, Cutomer ID: is bold; and the data "ABC" is not bold but is lined up
evenly with the next line
Customer Name: is bold; and the data "ABC is not bold but is lined up
evenly with the line above it

The line is next and is bold; And the line length is 60

There is a space or carriage return after the line
Notes: is bold; and then a carriage return
and then the notes data is not bold

Does anyone know how I can write the code for this:

Thanks,
Jeff
 
D

Dale Fye

Did something similar to this a while back.

If I remember correctly, I started out by creating a query, and used my code
to change the SQL string of the query to return only the necessary fields and
records from my database based on the item(s) selected by the listbox. I
used a command button on my form to update the SQL string for this query, and
open the Word document.

Then, I created a template document in Word that contained the formatting I
wanted. In your case, add a 2x2 table to the top of the document for the
customerID, Name, and data. This will allow you to get the alignment that
you want. Hide the lines in the table. Then add the separator line, and the
Notes header. Then do a mailmerge between that document and the query in
your database.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top