Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Suppress System Message

Status
Not open for further replies.

McCloud77

Instructor
Jun 4, 2001
8
CA
Hi Folks,

I invoke this sub from a form to append a record into a table. This table is the data source of a subform on my form. I prepare the data in the form and then pass it to the subform through updating its source then refresh the whole thing.

Private Sub btnAddToInvoice_Click()
DoCmd.RunSQL "INSERT INTO tblSalesDetails (SInvoiceID, ItemNumber, Qty, Warranty) " & _
"VALUES (SInvoiceID, tbxBrand, tbxQty, chkWarranty);"
Me.Refresh
End Sub

The problem is that each time I want to append a record a system message pops up to confirm the action. How can I suppress this message or at least customize it.

Thanks
 
Turn warnings of.

Example:


Private Sub btnAddToInvoice_Click()

DoCmd.SetWarnings False

DoCmd.RunSQL "INSERT INTO tblSalesDetails (SInvoiceID, ItemNumber, Qty, Warranty) " & _
"VALUES (SInvoiceID, tbxBrand, tbxQty, chkWarranty);"

DoCmd.SetWarnings True

Me.Refresh
End Sub

 
Make sure that you put that when you turn the messages off like Terry and Balor suggested that you turn them back on as in Balor's code. SetWarnings is a global command and turns it off throughout all of Access!

[tt]
DoCmd.SetWarnings False

Run My Code here...

DoCmd.SetWarnings True
[/tt]

Joe Miller
joe.miller@flotech.net
 
Thank you all. It worked very good. I did it as balor suggested; Off then On again. Do you think another type of warning (beside the confirmation message) may be suppressed? i.e. is it a safe practice to do the thing this way.

Thanks again,
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top