[mso] Re: DoCmd.SetWarnings for Access 2000

  • From: "Colli, Anthony G" <Anthony.Colli@xxxxxxx>
  • To: <mso@xxxxxxxxxxxxx>
  • Date: Wed, 10 Dec 2003 10:47:27 -0500


Lisa-

sgSQL = "DROP TABLE tblTempDP;"
On Error Resume Next
DoCmd.RunSQL sgSQL

Will likely work. On Error Resume Next will ignore any error that might
occur in the code. It's not a good thing to use lightly because you will
never know when your code is generating an error.

You should check to see if the table exists before you try and drop the
table. You can query MySysObjects to see if the table exists like this.

SELECT MSysObjects.Name
FROM MSysObjects
WHERE (((MSysObjects.Name)="tblTempDP"));

Then to delete the table you can use SQL or the ADOX library like this.

-------------------------------------------
Public Function DeleteTable()
Dim cat As ADOX.Catalog

Set cat = New ADOX.Catalog
cat.ActiveConnection = CurrentProject.Connection

On Error Resume Next
cat.Tables.Delete "tblTempDP"

cat.Tables.Refresh

Set cat = Nothing

End Function
--------------------------------------------

-Anthony

-----Original Message-----
From: Green [mailto:1z@xxxxxxxxxxxxxx]
Sent: Wednesday, December 10, 2003 6:04 AM
To: MSO
Subject: [mso] DoCmd.SetWarnings for Access 2000


Hi everyone,

I'm trying to run some code that I edited slightly that Michael Luevane
kindly sent me.

DoCmd.SetWarnings False
sgSQL = "DROP TABLE tblTempDP;"
DoCmd.RunSQL sgSQL

When it gets to the 3rd line I get a warning message that the table
doesn't exist. Can anyone see anything wrong with what I'm doing please?

Regards
Lisa






*************************************************************
You are receiving this mail because you subscribed to mso@xxxxxxxxxxxxx or 
MicrosoftOffice@xxxxxxxxxxxxxxxx

To send mail to the group, simply address it to mso@xxxxxxxxxxxxx

To Unsubscribe from this group, send an email to 
mso-request@xxxxxxxxxxxxx with the word "unsubscribe" (without the quotes) in 
the subject line.

Or, visit the group's homepage and use the dropdown menu.  This will also allow 
you to change your email settings to digest or vacation (no mail).
//www.freelists.org/webpage/mso

To be able to use the files section for sharing files with the group, send a 
request to mso-moderators@xxxxxxxxxxxxx and you will be sent an invitation with 
instructions.  Once you are a member of the files group, you can go here to 
upload/download files:
http://www.smartgroups.com/vault/msofiles
*************************************************************

Other related posts: