Link to home
Start Free TrialLog in
Avatar of burtonrhodes
burtonrhodes

asked on

Create fax cover letter from MS Access VBA

Not sure where to begin, but I would like to create a fax cover letter from my access application.  I am thinking I should do this with a Word Tempalte (.dot file) and open from access VBA, but I can't seem to get my head around how I would populate the template with the current records information (e.g. name, fax number, etc).  Does a template have field place holders that can be set from VBA?  Or is there a better way?  I thought about creating a report, but you can't manually enter text after you create a report.  I thought a word document would be better path.  Any help is appreciated!
ASKER CERTIFIED SOLUTION
Avatar of clarkscott
clarkscott
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Further....

If you use Word, you will have to RUN Access to get the query.

I have a system that the user selects a record from a form, clicks a button, and Word opens with the required merge data.

Create a global variable in Access
==================
Global glbRecID as long
==================

Create a function to return this variable

=================
Function get_glbRecID() AS LONG
get_glbRecID = glbRecID
End Function
==================

Create a query and set the criteria to the function

query column RECID
= get_glbRecID()

In the form, create a button that assigns a value to glbRecID
======================
Sub Button_click()
if not isnull(me.RECID) THEN
    glbRecID = me.RECID
    '------ SHELL to Word doc.  Word will open the document and link to this query
end if
End Sub
====================



I still think the Access Report is easier.....


Scott C.














Avatar of burtonrhodes
burtonrhodes

ASKER

I think you may be on the right track.  I was trying to stay away from a Report since the user couldn't type a personal message after the report was created...however, I could just have them type the custom message in a form before thereport is created.  Easy enough.

Many thanks.
If you include a memo field in your data table - you could supply a form textbox and allow the user to type in what they want.  Bind this field to your report and BINGO......

You could (in code) clear the memo field upon closing (so not to waste space saving this text)......


Scott C.