Terry-
To use RunCode, the code must be a Function in a Standard module. It cannot be
in code behind a form.
John Viescas, author
Microsoft Office Access 2010 Inside Out
Microsoft Office Access 2007 Inside Out
Building Microsoft Access Applications
Microsoft Office Access 2003 Inside Out
SQL Queries for Mere Mortals
http://www.viescas.com/
(Paris, France)
-----Original Message-----
From: MS_Access_Professionals@yahoogroups.com
[mailto:MS_Access_Professionals@yahoogroups.com] On Behalf Of Terry Olsen
Sent: Thursday, August 09, 2012 7:47 PM
To: MS_Access_Professionals@yahoogroups.com
Subject: Re: [MS_AccessPros] Access SQL Syntax for a Query to Drop a Table
Thanks, John. I created a module from your response -
DeleteTmpTblDailyImport(Access 2010. It looks like this. I tried to execute it
from a macro, using the runcode action. I got a message saying that it couldn't
find the name.
Option Compare Database
Dim db As DAO.Database
On Error Resume Next
Set db = CurrentDb
db.TableDefs.Delete "tblTmpTblDailDevconImport"
db.TableDefs.Delete "tblTmpTblDailyCoachOnHoldImport"
db.TableDefs.Delete "tmptblDailyOBSCommCoachImport"
db.TableDefs.Delete "tblTmpTblDailyVehicleAssign"
db.TableDefs.Delete "tblTmpTblDailyINITArchives\\\\'"
db.TableDefs.Delete "[Sheet1$_ImportErrors]"
Set db = Nothing
--- In MS_Access_Professionals@yahoogroups.com, John Viescas <JohnV@...> wrote:
>
> Terry-
>
> It's easier in VBA:
>
> Dim db As DAO.Database
> On Error Resume Next
>
> Set db = CurrentDb
> db.Tabledefs.Delete "tblTmpTblDailDevconImport"
> db.Tabledefs.Delete "tblTmpTblDailyCoachOnHoldImport"
> db.Tabledefs.Delete "tmptblDailyOBSCommCoachImport
> db.Tabledefs.Delete "tblTmpTblDailyVehicleAssign"
> db.Tabledefs.Delete "tblTmpTblDailyINITArchives\\\\'
> db.Tabledefs.Delete "[Sheet1$_ImportErrors]"
> Set db = Nothing
>
> John Viescas, author
> Microsoft Office Access 2010 Inside Out
> Microsoft Office Access 2007 Inside Out
> Building Microsoft Access Applications
> Microsoft Office Access 2003 Inside Out
> SQL Queries for Mere Mortals
> http://www.viescas.com/
> (Paris, France)
>
>
>
>
> -----Original Message-----
> From: MS_Access_Professionals@yahoogroups.com
> [mailto:MS_Access_Professionals@yahoogroups.com] On Behalf Of Terry Olsen
> Sent: Thursday, August 09, 2012 5:36 PM
> To: MS_Access_Professionals@yahoogroups.com
> Subject: [MS_AccessPros] Access SQL Syntax for a Query to Drop a Table
>
> I have a table that I would like to drop, if it exists.
> I have a query that drops several tables. All, but one exists whenever this
> query is called from a macro. The [Sheet1$_ImportErrors] may or may not be
> there.
>
> drop table tblTmpTblDailyDevconImport,
> tblTmpTblDailyCoachOnHoldImport,
> tmptblDailyOBSCommCoachImport,
> tblTmpTblDailyVehicleAssign,
> tblTmpTblDailyINITArchives,
> [Sheet1$_ImportErrors];
>
> Thanks for any suggestions
> Terryomsn
>
>
>
> ------------------------------------
>
> Yahoo! Groups Links
>
------------------------------------
Yahoo! Groups Links
Kamis, 09 Agustus 2012
RE: [MS_AccessPros] Access SQL Syntax for a Query to Drop a Table
__._,_.___
.
__,_._,___
Langganan:
Posting Komentar (Atom)
Tidak ada komentar:
Posting Komentar