Full Version: Open Form Event And Set Warnings False
UtterAccess Forums > Microsoft® Access > Access Forms
Brandi
I do not have the Confirm Action queries turned on under Tools, Options.
Below is the code that I have for the On Open event of a form. When the form opens a Make Table query runs so that I can capture data to print various reports and letters. Even though I have SetWarnings Off, I still get a message that the previous table will be deleted before the make table query recreates it. Is there a way to get rid of this message?
Private Sub Form_Open(Cancel As Integer)
DoCmd.SetWarnings False
DoCmd.Maximize
DoCmd.OpenQuery "qryCoDefendantsMakeTable"
DoCmd.SetWarnings True
End Sub
Thank you.
Brandi
AC2Designs
if the temp table already exists you will get that error.
You'll have to drop it before it is recreated.
Private Sub Form_Open(Cancel As Integer)
DoCmd.SetWarnings False
DoCmd.Maximize
strSQL = "Drop Table [tablename]"
DoCmd.RunSQL strSQL
DoCmd.OpenQuery "qryCoDefendantsMakeTable"
DoCmd.SetWarnings True
End Sub
Kevin
Brandi
[quote name='AC2Designs' date='Mar 3 2010, 08:05 PM' post='1943221']
Thank you Kevin. That works great! I will use this often.
randi
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.