Hiding Messages from Append Query queries

  • Thread starter Thread starter chuckW
  • Start date Start date
C

chuckW

Hi,

I am building an application runs an append query behind
the scenes and then runs a query off of this table that
has been appended. I want to front end this with a
button on a form. The problem is that I get the typical
message saying "You are about to add 4356 record to your
table is that OK?". I would like to hide this from the
user and not get these messages. Is there a way to do
this? I know it may take some VBA code which I don't
know very well.

Thanks,

Chuck
 
If you used the wizard to make your button then it will have written most of
the VBA code for you. Open the property box for the button, click the Event
tab and then click the ellipsis (...) next to the Click event. This should
bring up the code window that will show something like this:

Private Sub Command15_Click()
On Error GoTo Err_Command15_Click

Dim stDocName As String

stDocName = "qmtLatestStatistics"
DoCmd.OpenQuery stDocName, acNormal, acEdit

Exit_Command15_Click:
Exit Sub

Err_Command15_Click:
MsgBox Err.Description
Resume Exit_Command15_Click

End Sub

Type "DoCmd.SetWarnings False on a new line just before the line that starts
DoCmd.OpenQuery. Then type "DoCmd.SetWarnings True" on the line just before
the line that says "Exit Sub", ie just after the line Exit_Command15_Click:
(this line will have the name of your button rather than Command15).
 
Before the query runs "Setwarnings to false". don't
forget to SetWarnings to True after.

Jim
 
Back
Top