O
Owen WIlson
Hello,
I have a form on which the user can enter information
that will be put into a letter. When the user clicks on
the PRINT button, a letter is printed and a transmittal
form is printed.
The information for the transmittal is taken from the
Letter form and appended to a table named
tblTransmittalInfo, which has a field named LetterNumber
that is set as the primary key and another field named
TransmittalNumber that generates an autonumber to be used
for tracking and logging purposes. The primary key
prevents the program from adding new Transmittal Numbers
should the user print the letter more than once. (Should
they lose the original, for example)
This all works great but I get the usual warning messages
from Access - "You are about to Append X number of
records" and "Access did not post X records because
blah, blah blah.
Is there a way to turn off these message boxes?
TIA
Owen Wilson
Attached is the code I used for the Print Preview
procedure:
Private Sub cmdPreview_Click()
On Error GoTo Err_CmdPrint_Click
Dim stDocName As String
Dim strFilter As String
Dim strLetterFilter As String
Dim strSQL As String
Dim lngnum As Long
Screen.PreviousControl.SetFocus
'Make sure "To" field is NOT NULL
cboTo.SetFocus
If cboTo.Text = "" Then
MsgBox ("Please Enter a Contact Name")
Exit Sub
End If
'Show Letter in Print Preview
strFilter = LetterNum.Value
stDocName = "Letterrpt"
strFilter = "LetterNum = Forms!LetterTable!LetterNum"
DoCmd.OpenReport stDocName, acViewPreview, , strFilter
'Show Accompanying Transmittal in Print Preview
LetterNum.SetFocus
strFilter = LetterNum.Text
stDocName = "LetterTrans"
strLetterFilter = "LetterNum = Forms!LetterTable!
LetterNum"
DoCmd.OpenReport stDocName, acViewPreview, ,
strLetterFilter
'Insert into tblTransmittalInfo to produce unique
transmittal
lngnum = LetterNum.Text
strSQL = "INSERT INTO tblTransmittalInfo (LetterNumber,
Date1, No1, Desc1) " _
& "SELECT LetterNum, LetterDate, LetterNum, Re "
_
& "FROM LetterTable " _
& "WHERE LetterNum = " & lngnum & ";"
DoCmd.RunSQL strSQL
Exit_CmdPrint_Click:
Exit Sub
Err_CmdPrint_Click:
MsgBox Err.Description
Resume Exit_CmdPrint_Click
End Sub
I have a form on which the user can enter information
that will be put into a letter. When the user clicks on
the PRINT button, a letter is printed and a transmittal
form is printed.
The information for the transmittal is taken from the
Letter form and appended to a table named
tblTransmittalInfo, which has a field named LetterNumber
that is set as the primary key and another field named
TransmittalNumber that generates an autonumber to be used
for tracking and logging purposes. The primary key
prevents the program from adding new Transmittal Numbers
should the user print the letter more than once. (Should
they lose the original, for example)
This all works great but I get the usual warning messages
from Access - "You are about to Append X number of
records" and "Access did not post X records because
blah, blah blah.
Is there a way to turn off these message boxes?
TIA
Owen Wilson
Attached is the code I used for the Print Preview
procedure:
Private Sub cmdPreview_Click()
On Error GoTo Err_CmdPrint_Click
Dim stDocName As String
Dim strFilter As String
Dim strLetterFilter As String
Dim strSQL As String
Dim lngnum As Long
Screen.PreviousControl.SetFocus
'Make sure "To" field is NOT NULL
cboTo.SetFocus
If cboTo.Text = "" Then
MsgBox ("Please Enter a Contact Name")
Exit Sub
End If
'Show Letter in Print Preview
strFilter = LetterNum.Value
stDocName = "Letterrpt"
strFilter = "LetterNum = Forms!LetterTable!LetterNum"
DoCmd.OpenReport stDocName, acViewPreview, , strFilter
'Show Accompanying Transmittal in Print Preview
LetterNum.SetFocus
strFilter = LetterNum.Text
stDocName = "LetterTrans"
strLetterFilter = "LetterNum = Forms!LetterTable!
LetterNum"
DoCmd.OpenReport stDocName, acViewPreview, ,
strLetterFilter
'Insert into tblTransmittalInfo to produce unique
transmittal
lngnum = LetterNum.Text
strSQL = "INSERT INTO tblTransmittalInfo (LetterNumber,
Date1, No1, Desc1) " _
& "SELECT LetterNum, LetterDate, LetterNum, Re "
_
& "FROM LetterTable " _
& "WHERE LetterNum = " & lngnum & ";"
DoCmd.RunSQL strSQL
Exit_CmdPrint_Click:
Exit Sub
Err_CmdPrint_Click:
MsgBox Err.Description
Resume Exit_CmdPrint_Click
End Sub