Problem with format when printing to Word from Access

G

Guest

Hi All,

I posted a question last week regarding printing multiple copies of a Word
document from Access. I got the help I needed, but now have a different
problem relating to my code (please see below for original post containing
code).

My new problem is that one of my fields in Access I populate my bookmark in
Word is in currency format. When I send the info to Word, it drops all zeros
off the end of the amount.

For example:

In Access I have $240.00
When it is sent to Word it shows up as $240
In Access $240.10
In Word $240.1
In Access $240.01
In Word $240.01

As you can see, it drops off the last zero after the decimal point.

Does anyone know of a solution to this problem? Any help would be greatly
appreciated!

Robert
Hi all,

I'm trying to work out a kink I'm having with one of the pieces of my
database.

Users of my db have the ability to print Word documents from a form.
Sequentially, they go to the "Letters" form, select which letter to print
from a combo box, Access pulls the pertinent information depending on which
letter type was selected, users can then edit whatever needs to be edited,
they click a Print command button, Word is called and prints out the document
and closes back down, and then an append query is run to append the
type/date/by whom the letter was printed to a letter history table.

Well, all this works fantastically, exept for when they want to print
multiple copies of a document. Obviously, they can do this by clicking the
Print button multiple times, but this causes the append query to append the
same info over and over once for each time the letter was printed.

I'm sure I can make the append query stop appending multiples, if I had
to... but that doesn't solve the bigger issue. I don't want users to have to
click that button 2, 3, whatever number of times. Below is a snippet of the
code I'm using to do all this. I'm only showing the process for two of the
letters used to give an idea:

Option Compare Database
Option Explicit

Private Sub Form_Load()

With Me

.lblField1.Visible = False
.lblField2.Visible = False
.lblField3.Visible = False
.lblField4.Visible = False
.lblField5.Visible = False
.lblField6.Visible = False
.txtField1.Visible = False
.txtField2.Visible = False
.txtField3.Visible = False
.txtField4.Visible = False
.txtField5.Visible = False
.txtField6.Visible = False

End With

End Sub

Private Sub cboLetterType_change()

If Me.cboLetterType.Value = "Dual Enrollment" Then

.lblField1.Visible = True
.lblField1.Caption = "Healthy Options Plan"
.txtField1.Visible = True
.txtField1.ControlSource = "[DualEnrollHOPlan]"
.lblField2.Visible = True
.lblField2.Caption = "End Date"
.txtField2.Visible = True
.txtField2.ControlSource = "[DualEnrollEndDate]"
.lblField3.Visible = True
.lblField3.Caption = "Insurance Company"
.txtField3.Visible = True
.txtField3.ControlSource = "[DualEnrollInsCo]"
.lblField4.Visible = True
.lblField4.Caption = "Subscriber"
.txtField4.Visible = True
.txtField4.ControlSource = "[DualEnrollSubscriber]"
.lblField5.Visible = True
.lblField5.Caption = "Insurance Phone Number"
.txtField5.Visible = True
.txtField5.ControlSource = "[DualEnrollInsPhNumber]"
.lblField6.Visible = False
.txtField6.Visible = False

End With

ElseIf Me.cboLetterType.Value = "Welcome" Then

With Me

.lblField1.Visible = True
.lblField1.Caption = "Client(s)"
.txtField1.Visible = True
.txtField1.ControlSource = "[WelcomeClients]"
.lblField2.Visible = True
.lblField2.Caption = "Amount"
.txtField2.Visible = True
.txtField2.ControlSource = "[WelcomeAmount]"
.lblField3.Visible = True
.lblField3.Caption = "Frequency"
.txtField3.Visible = True
.txtField3.ControlSource = "[WelcomeFrequency]"
.lblField4.Visible = False
.txtField4.Visible = False
.lblField5.Visible = False
.txtField5.Visible = False
.lblField6.Visible = False
.txtField6.Visible = False

End With

End If

End Sub
Private Sub cmdMerge_Click()

On Error GoTo cmdMerge_Err

'Start Microsoft Word
Dim objWord As Word.Application
Set objWord = CreateObject("Word.Application")

If Me.cboLetterType.Value = "Dual Enrollment" Then

With objWord

'Make the application visible.
.Visible = True
'Open the document.
.Documents.Open ("\\dshsfloly7002\Kdrive\DATA\ESI\Letters\DualEnrollment.doc")

'Move to each bookmark and insert text from the form.
.ActiveDocument.Bookmarks("FirstName1").Select
.Selection.Text = (CStr(Forms![frmLetterInfo]![txtHOH_FNAME]))
.ActiveDocument.Bookmarks("LastName").Select
.Selection.Text = (CStr(Forms![frmLetterInfo]![txtHOH_LNAME]))
.ActiveDocument.Bookmarks("Address1").Select
.Selection.Text = (CStr(Forms![frmLetterInfo]![txtMAIL_ADDRESS]))
.ActiveDocument.Bookmarks("Address2").Select
.Selection.Text = (CStr(Forms![frmLetterInfo]![txtMAIL_ADDRESS2]))
.ActiveDocument.Bookmarks("HOH").Select
.Selection.Text = (CStr(Forms![frmLetterInfo]![txtHOH_ID_NUM]))
.ActiveDocument.Bookmarks("HOPlan").Select
.Selection.Text = (CStr(Forms![frmLetterInfo]![DualEnrollHOPlan]))
.ActiveDocument.Bookmarks("EndDate").Select
.Selection.Text = (CStr(Forms![frmLetterInfo]![DualEnrollEndDate]))
.ActiveDocument.Bookmarks("InsCo1").Select
.Selection.Text = (CStr(Forms![frmLetterInfo]![DualEnrollInsCo]))
.ActiveDocument.Bookmarks("InsCo2").Select
.Selection.Text = (CStr(Forms![frmLetterInfo]![DualEnrollInsCo]))
.ActiveDocument.Bookmarks("Subscriber").Select
.Selection.Text = (CStr(Forms![frmLetterInfo]![DualEnrollSubscriber]))
.ActiveDocument.Bookmarks("InsCoPhone").Select
.Selection.Text = (CStr(Forms![frmLetterInfo]![DualEnrollInsPhNumber]))

End With

ElseIf Me.cboLetterType.Value = "Welcome" Then

With objWord

'Make the application visible.
.Visible = True
'Open the document.
.Documents.Open ("\\dshsfloly7002\Kdrive\DATA\ESI\Letters\Welcome.doc")

'Move to each bookmark and insert text from the form.
.ActiveDocument.Bookmarks("FirstName1").Select
.Selection.Text = (CStr(Forms![frmLetterInfo]![txtHOH_FNAME]))
.ActiveDocument.Bookmarks("FirstName2").Select
.Selection.Text = (CStr(Forms![frmLetterInfo]![txtHOH_FNAME]))
.ActiveDocument.Bookmarks("LastName").Select
.Selection.Text = (CStr(Forms![frmLetterInfo]![txtHOH_LNAME]))
.ActiveDocument.Bookmarks("Address1").Select
.Selection.Text = (CStr(Forms![frmLetterInfo]![txtMAIL_ADDRESS]))
.ActiveDocument.Bookmarks("Address2").Select
.Selection.Text = (CStr(Forms![frmLetterInfo]![txtMAIL_ADDRESS2]))
.ActiveDocument.Bookmarks("HOH").Select
.Selection.Text = (CStr(Forms![frmLetterInfo]![txtHOH_ID_NUM]))
.ActiveDocument.Bookmarks("WelcomeClients").Select
.Selection.Text = (CStr(Forms![frmLetterInfo]![WelcomeClients]))
.ActiveDocument.Bookmarks("WelcomeAmount").Select
.Selection.Text = (CStr(Forms![frmLetterInfo]![WelcomeAmount]))
.ActiveDocument.Bookmarks("WelcomeFrequency").Select
.Selection.Text = (CStr(Forms![frmLetterInfo]![WelcomeFrequency]))

End With

End If

'Append information to tblLetterHistory.
DoCmd.OpenQuery "qryAppendLetterHistory", acViewNormal, acEdit

'Print the document in the foreground so Microsoft Word will not close
'until the document finishes printing.
objWord.ActiveDocument.PrintOut Background:=False

'Close the document without saving changes.
objWord.ActiveDocument.Close SaveChanges:=wdDoNotSaveChanges

'Quit Microsoft Word and release the object variable.
objWord.Quit
Set objWord = CreateObject("Word.Application")

Exit Sub

cmdMerge_Err:

'If a field on the form is empty, remove the bookmark text, and
'continue.
If Err.Number = 94 Then
objWord.Selection.Text = ""
Resume Next

End If

Exit Sub

End Sub


If there is any way for my to allow users to enter in the amount of copies
they wish to print, or even code in the amount of times to print a certain
type of letter, I would really appreciate some help on this! If you need any
more information as to what I am trying to achieve, just ask!

Robert
 
G

Guest

If this is a merge document, then do the following. In your Word document,
type Alt-F9 to display the field codes. You should see something like this:

{ MERGEFIELD "FieldName" }

Before the closing bracket, with a space after the last quotation mark, type
this:

\# $#,###.00

Type Alt-F9 to return to the text. Save and close, then re-open. Your
numbers should properly format.

RobertG said:
Hi All,

I posted a question last week regarding printing multiple copies of a Word
document from Access. I got the help I needed, but now have a different
problem relating to my code (please see below for original post containing
code).

My new problem is that one of my fields in Access I populate my bookmark in
Word is in currency format. When I send the info to Word, it drops all zeros
off the end of the amount.

For example:

In Access I have $240.00
When it is sent to Word it shows up as $240
In Access $240.10
In Word $240.1
In Access $240.01
In Word $240.01

As you can see, it drops off the last zero after the decimal point.

Does anyone know of a solution to this problem? Any help would be greatly
appreciated!

Robert
Hi all,

I'm trying to work out a kink I'm having with one of the pieces of my
database.

Users of my db have the ability to print Word documents from a form.
Sequentially, they go to the "Letters" form, select which letter to print
from a combo box, Access pulls the pertinent information depending on which
letter type was selected, users can then edit whatever needs to be edited,
they click a Print command button, Word is called and prints out the document
and closes back down, and then an append query is run to append the
type/date/by whom the letter was printed to a letter history table.

Well, all this works fantastically, exept for when they want to print
multiple copies of a document. Obviously, they can do this by clicking the
Print button multiple times, but this causes the append query to append the
same info over and over once for each time the letter was printed.

I'm sure I can make the append query stop appending multiples, if I had
to... but that doesn't solve the bigger issue. I don't want users to have to
click that button 2, 3, whatever number of times. Below is a snippet of the
code I'm using to do all this. I'm only showing the process for two of the
letters used to give an idea:

Option Compare Database
Option Explicit

Private Sub Form_Load()

With Me

.lblField1.Visible = False
.lblField2.Visible = False
.lblField3.Visible = False
.lblField4.Visible = False
.lblField5.Visible = False
.lblField6.Visible = False
.txtField1.Visible = False
.txtField2.Visible = False
.txtField3.Visible = False
.txtField4.Visible = False
.txtField5.Visible = False
.txtField6.Visible = False

End With

End Sub

Private Sub cboLetterType_change()

If Me.cboLetterType.Value = "Dual Enrollment" Then

.lblField1.Visible = True
.lblField1.Caption = "Healthy Options Plan"
.txtField1.Visible = True
.txtField1.ControlSource = "[DualEnrollHOPlan]"
.lblField2.Visible = True
.lblField2.Caption = "End Date"
.txtField2.Visible = True
.txtField2.ControlSource = "[DualEnrollEndDate]"
.lblField3.Visible = True
.lblField3.Caption = "Insurance Company"
.txtField3.Visible = True
.txtField3.ControlSource = "[DualEnrollInsCo]"
.lblField4.Visible = True
.lblField4.Caption = "Subscriber"
.txtField4.Visible = True
.txtField4.ControlSource = "[DualEnrollSubscriber]"
.lblField5.Visible = True
.lblField5.Caption = "Insurance Phone Number"
.txtField5.Visible = True
.txtField5.ControlSource = "[DualEnrollInsPhNumber]"
.lblField6.Visible = False
.txtField6.Visible = False

End With

ElseIf Me.cboLetterType.Value = "Welcome" Then

With Me

.lblField1.Visible = True
.lblField1.Caption = "Client(s)"
.txtField1.Visible = True
.txtField1.ControlSource = "[WelcomeClients]"
.lblField2.Visible = True
.lblField2.Caption = "Amount"
.txtField2.Visible = True
.txtField2.ControlSource = "[WelcomeAmount]"
.lblField3.Visible = True
.lblField3.Caption = "Frequency"
.txtField3.Visible = True
.txtField3.ControlSource = "[WelcomeFrequency]"
.lblField4.Visible = False
.txtField4.Visible = False
.lblField5.Visible = False
.txtField5.Visible = False
.lblField6.Visible = False
.txtField6.Visible = False

End With

End If

End Sub
Private Sub cmdMerge_Click()

On Error GoTo cmdMerge_Err

'Start Microsoft Word
Dim objWord As Word.Application
Set objWord = CreateObject("Word.Application")

If Me.cboLetterType.Value = "Dual Enrollment" Then

With objWord

'Make the application visible.
.Visible = True
'Open the document.
.Documents.Open ("\\dshsfloly7002\Kdrive\DATA\ESI\Letters\DualEnrollment.doc")

'Move to each bookmark and insert text from the form.
.ActiveDocument.Bookmarks("FirstName1").Select
.Selection.Text = (CStr(Forms![frmLetterInfo]![txtHOH_FNAME]))
.ActiveDocument.Bookmarks("LastName").Select
.Selection.Text = (CStr(Forms![frmLetterInfo]![txtHOH_LNAME]))
.ActiveDocument.Bookmarks("Address1").Select
.Selection.Text = (CStr(Forms![frmLetterInfo]![txtMAIL_ADDRESS]))
.ActiveDocument.Bookmarks("Address2").Select
.Selection.Text = (CStr(Forms![frmLetterInfo]![txtMAIL_ADDRESS2]))
.ActiveDocument.Bookmarks("HOH").Select
.Selection.Text = (CStr(Forms![frmLetterInfo]![txtHOH_ID_NUM]))
.ActiveDocument.Bookmarks("HOPlan").Select
.Selection.Text = (CStr(Forms![frmLetterInfo]![DualEnrollHOPlan]))
.ActiveDocument.Bookmarks("EndDate").Select
.Selection.Text = (CStr(Forms![frmLetterInfo]![DualEnrollEndDate]))
.ActiveDocument.Bookmarks("InsCo1").Select
.Selection.Text = (CStr(Forms![frmLetterInfo]![DualEnrollInsCo]))
.ActiveDocument.Bookmarks("InsCo2").Select
.Selection.Text = (CStr(Forms![frmLetterInfo]![DualEnrollInsCo]))
.ActiveDocument.Bookmarks("Subscriber").Select
.Selection.Text = (CStr(Forms![frmLetterInfo]![DualEnrollSubscriber]))
.ActiveDocument.Bookmarks("InsCoPhone").Select
.Selection.Text = (CStr(Forms![frmLetterInfo]![DualEnrollInsPhNumber]))

End With

ElseIf Me.cboLetterType.Value = "Welcome" Then

With objWord

'Make the application visible.
.Visible = True
'Open the document.
.Documents.Open ("\\dshsfloly7002\Kdrive\DATA\ESI\Letters\Welcome.doc")

'Move to each bookmark and insert text from the form.
.ActiveDocument.Bookmarks("FirstName1").Select
.Selection.Text = (CStr(Forms![frmLetterInfo]![txtHOH_FNAME]))
.ActiveDocument.Bookmarks("FirstName2").Select
.Selection.Text = (CStr(Forms![frmLetterInfo]![txtHOH_FNAME]))
.ActiveDocument.Bookmarks("LastName").Select
.Selection.Text = (CStr(Forms![frmLetterInfo]![txtHOH_LNAME]))
.ActiveDocument.Bookmarks("Address1").Select
.Selection.Text = (CStr(Forms![frmLetterInfo]![txtMAIL_ADDRESS]))
.ActiveDocument.Bookmarks("Address2").Select
.Selection.Text = (CStr(Forms![frmLetterInfo]![txtMAIL_ADDRESS2]))
.ActiveDocument.Bookmarks("HOH").Select
.Selection.Text = (CStr(Forms![frmLetterInfo]![txtHOH_ID_NUM]))
.ActiveDocument.Bookmarks("WelcomeClients").Select
.Selection.Text = (CStr(Forms![frmLetterInfo]![WelcomeClients]))
.ActiveDocument.Bookmarks("WelcomeAmount").Select
.Selection.Text = (CStr(Forms![frmLetterInfo]![WelcomeAmount]))
.ActiveDocument.Bookmarks("WelcomeFrequency").Select
.Selection.Text = (CStr(Forms![frmLetterInfo]![WelcomeFrequency]))

End With

End If

'Append information to tblLetterHistory.
DoCmd.OpenQuery "qryAppendLetterHistory", acViewNormal, acEdit

'Print the document in the foreground so Microsoft Word will not close
'until the document finishes printing.
objWord.ActiveDocument.PrintOut Background:=False

'Close the document without saving changes.
objWord.ActiveDocument.Close SaveChanges:=wdDoNotSaveChanges

'Quit Microsoft Word and release the object variable.
objWord.Quit
Set objWord = CreateObject("Word.Application")

Exit Sub

cmdMerge_Err:

'If a field on the form is empty, remove the bookmark text, and
'continue.
If Err.Number = 94 Then
objWord.Selection.Text = ""
Resume Next

End If

Exit Sub

End Sub


If there is any way for my to allow users to enter in the amount of copies
they wish to print, or even code in the amount of times to print a certain
type of letter, I would really appreciate some help on this! If you need any
more information as to what I am trying to achieve, just ask!

Robert
 
J

John Nurick

Hi Robert,

It's a long time since I've coded this, but have you tried explicitly
converting the amount to a string by using the Format() function in
your query, e.g.
Format([MyField], "$#,##0.00")
?

Hi All,

I posted a question last week regarding printing multiple copies of a Word
document from Access. I got the help I needed, but now have a different
problem relating to my code (please see below for original post containing
code).

My new problem is that one of my fields in Access I populate my bookmark in
Word is in currency format. When I send the info to Word, it drops all zeros
off the end of the amount.

For example:

In Access I have $240.00
When it is sent to Word it shows up as $240
In Access $240.10
In Word $240.1
In Access $240.01
In Word $240.01

As you can see, it drops off the last zero after the decimal point.

Does anyone know of a solution to this problem? Any help would be greatly
appreciated!

Robert
Hi all,

I'm trying to work out a kink I'm having with one of the pieces of my
database.

Users of my db have the ability to print Word documents from a form.
Sequentially, they go to the "Letters" form, select which letter to print
from a combo box, Access pulls the pertinent information depending on which
letter type was selected, users can then edit whatever needs to be edited,
they click a Print command button, Word is called and prints out the document
and closes back down, and then an append query is run to append the
type/date/by whom the letter was printed to a letter history table.

Well, all this works fantastically, exept for when they want to print
multiple copies of a document. Obviously, they can do this by clicking the
Print button multiple times, but this causes the append query to append the
same info over and over once for each time the letter was printed.

I'm sure I can make the append query stop appending multiples, if I had
to... but that doesn't solve the bigger issue. I don't want users to have to
click that button 2, 3, whatever number of times. Below is a snippet of the
code I'm using to do all this. I'm only showing the process for two of the
letters used to give an idea:

Option Compare Database
Option Explicit

Private Sub Form_Load()

With Me

.lblField1.Visible = False
.lblField2.Visible = False
.lblField3.Visible = False
.lblField4.Visible = False
.lblField5.Visible = False
.lblField6.Visible = False
.txtField1.Visible = False
.txtField2.Visible = False
.txtField3.Visible = False
.txtField4.Visible = False
.txtField5.Visible = False
.txtField6.Visible = False

End With

End Sub

Private Sub cboLetterType_change()

If Me.cboLetterType.Value = "Dual Enrollment" Then

.lblField1.Visible = True
.lblField1.Caption = "Healthy Options Plan"
.txtField1.Visible = True
.txtField1.ControlSource = "[DualEnrollHOPlan]"
.lblField2.Visible = True
.lblField2.Caption = "End Date"
.txtField2.Visible = True
.txtField2.ControlSource = "[DualEnrollEndDate]"
.lblField3.Visible = True
.lblField3.Caption = "Insurance Company"
.txtField3.Visible = True
.txtField3.ControlSource = "[DualEnrollInsCo]"
.lblField4.Visible = True
.lblField4.Caption = "Subscriber"
.txtField4.Visible = True
.txtField4.ControlSource = "[DualEnrollSubscriber]"
.lblField5.Visible = True
.lblField5.Caption = "Insurance Phone Number"
.txtField5.Visible = True
.txtField5.ControlSource = "[DualEnrollInsPhNumber]"
.lblField6.Visible = False
.txtField6.Visible = False

End With

ElseIf Me.cboLetterType.Value = "Welcome" Then

With Me

.lblField1.Visible = True
.lblField1.Caption = "Client(s)"
.txtField1.Visible = True
.txtField1.ControlSource = "[WelcomeClients]"
.lblField2.Visible = True
.lblField2.Caption = "Amount"
.txtField2.Visible = True
.txtField2.ControlSource = "[WelcomeAmount]"
.lblField3.Visible = True
.lblField3.Caption = "Frequency"
.txtField3.Visible = True
.txtField3.ControlSource = "[WelcomeFrequency]"
.lblField4.Visible = False
.txtField4.Visible = False
.lblField5.Visible = False
.txtField5.Visible = False
.lblField6.Visible = False
.txtField6.Visible = False

End With

End If

End Sub
Private Sub cmdMerge_Click()

On Error GoTo cmdMerge_Err

'Start Microsoft Word
Dim objWord As Word.Application
Set objWord = CreateObject("Word.Application")

If Me.cboLetterType.Value = "Dual Enrollment" Then

With objWord

'Make the application visible.
.Visible = True
'Open the document.
.Documents.Open ("\\dshsfloly7002\Kdrive\DATA\ESI\Letters\DualEnrollment.doc")

'Move to each bookmark and insert text from the form.
.ActiveDocument.Bookmarks("FirstName1").Select
.Selection.Text = (CStr(Forms![frmLetterInfo]![txtHOH_FNAME]))
.ActiveDocument.Bookmarks("LastName").Select
.Selection.Text = (CStr(Forms![frmLetterInfo]![txtHOH_LNAME]))
.ActiveDocument.Bookmarks("Address1").Select
.Selection.Text = (CStr(Forms![frmLetterInfo]![txtMAIL_ADDRESS]))
.ActiveDocument.Bookmarks("Address2").Select
.Selection.Text = (CStr(Forms![frmLetterInfo]![txtMAIL_ADDRESS2]))
.ActiveDocument.Bookmarks("HOH").Select
.Selection.Text = (CStr(Forms![frmLetterInfo]![txtHOH_ID_NUM]))
.ActiveDocument.Bookmarks("HOPlan").Select
.Selection.Text = (CStr(Forms![frmLetterInfo]![DualEnrollHOPlan]))
.ActiveDocument.Bookmarks("EndDate").Select
.Selection.Text = (CStr(Forms![frmLetterInfo]![DualEnrollEndDate]))
.ActiveDocument.Bookmarks("InsCo1").Select
.Selection.Text = (CStr(Forms![frmLetterInfo]![DualEnrollInsCo]))
.ActiveDocument.Bookmarks("InsCo2").Select
.Selection.Text = (CStr(Forms![frmLetterInfo]![DualEnrollInsCo]))
.ActiveDocument.Bookmarks("Subscriber").Select
.Selection.Text = (CStr(Forms![frmLetterInfo]![DualEnrollSubscriber]))
.ActiveDocument.Bookmarks("InsCoPhone").Select
.Selection.Text = (CStr(Forms![frmLetterInfo]![DualEnrollInsPhNumber]))

End With

ElseIf Me.cboLetterType.Value = "Welcome" Then

With objWord

'Make the application visible.
.Visible = True
'Open the document.
.Documents.Open ("\\dshsfloly7002\Kdrive\DATA\ESI\Letters\Welcome.doc")

'Move to each bookmark and insert text from the form.
.ActiveDocument.Bookmarks("FirstName1").Select
.Selection.Text = (CStr(Forms![frmLetterInfo]![txtHOH_FNAME]))
.ActiveDocument.Bookmarks("FirstName2").Select
.Selection.Text = (CStr(Forms![frmLetterInfo]![txtHOH_FNAME]))
.ActiveDocument.Bookmarks("LastName").Select
.Selection.Text = (CStr(Forms![frmLetterInfo]![txtHOH_LNAME]))
.ActiveDocument.Bookmarks("Address1").Select
.Selection.Text = (CStr(Forms![frmLetterInfo]![txtMAIL_ADDRESS]))
.ActiveDocument.Bookmarks("Address2").Select
.Selection.Text = (CStr(Forms![frmLetterInfo]![txtMAIL_ADDRESS2]))
.ActiveDocument.Bookmarks("HOH").Select
.Selection.Text = (CStr(Forms![frmLetterInfo]![txtHOH_ID_NUM]))
.ActiveDocument.Bookmarks("WelcomeClients").Select
.Selection.Text = (CStr(Forms![frmLetterInfo]![WelcomeClients]))
.ActiveDocument.Bookmarks("WelcomeAmount").Select
.Selection.Text = (CStr(Forms![frmLetterInfo]![WelcomeAmount]))
.ActiveDocument.Bookmarks("WelcomeFrequency").Select
.Selection.Text = (CStr(Forms![frmLetterInfo]![WelcomeFrequency]))

End With

End If

'Append information to tblLetterHistory.
DoCmd.OpenQuery "qryAppendLetterHistory", acViewNormal, acEdit

'Print the document in the foreground so Microsoft Word will not close
'until the document finishes printing.
objWord.ActiveDocument.PrintOut Background:=False

'Close the document without saving changes.
objWord.ActiveDocument.Close SaveChanges:=wdDoNotSaveChanges

'Quit Microsoft Word and release the object variable.
objWord.Quit
Set objWord = CreateObject("Word.Application")

Exit Sub

cmdMerge_Err:

'If a field on the form is empty, remove the bookmark text, and
'continue.
If Err.Number = 94 Then
objWord.Selection.Text = ""
Resume Next

End If

Exit Sub

End Sub


If there is any way for my to allow users to enter in the amount of copies
they wish to print, or even code in the amount of times to print a certain
type of letter, I would really appreciate some help on this! If you need any
more information as to what I am trying to achieve, just ask!

Robert
 

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