Turn Off Message Box

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
 
S

Sandra Daigle

To disable the warnings/messages from an update or append query use:

Docmd.SetWarnings False


Make sure when you have executed the query you follow that
with Docmd.SetWarnings True
 

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

Similar Threads

VBA Code for printing one page in a report 1
Optional reports 1
Code for printing routine 1
Pulling a single page report 1
Print page 1 of a report 2
PrintMode 2
Form to report by CMD BTN 2
Search (Like) 3

Top