|
-
November 30th, 1999, 01:58 PM
#1
Delete table in Access Database
How can I delete table in Access Database?
I try with this:
Dim dbsNew As Database
Dim wrkDefault As Workspace
Dim td As TableDef
Set dbsNew = OpenConnection("c:\Windows\Temp\MarteleurVirtuel.mdb")
Set wrkDefault = DBEngine.Workspaces(0)
td.Name = "Position ha"
dbsNew.TableDefs.Delete td
But it was not a success. I recive an error at the last line: ("Type mismatch")
Has anyone can help me?
Thanks!
Redg
-
November 30th, 1999, 03:13 PM
#2
Re: Delete table in Access Database
Hi.
When you're going to delete a table you don't need to declare a TableDef object.
Do like this:
dbsNew.TableDefs.Delete "Position ha"
/Michael Nattfalk
-
November 30th, 1999, 03:28 PM
#3
Re: Delete table in Access Database
Redg,
Try this code instead and change the what you need to change.
Dim dbsNew As Database
Dim td As TableDef
Set dbsNew = OpenDatabase("d:\vbhelp\tbldel\db3.mdb")
dbsNew.TableDefs.Delete "Table1"
Allen Noakes
VB Programmer/Analyst
Dames & Moore Group
[email protected]
-
November 30th, 1999, 10:39 PM
#4
Re: Delete table in Access Database
Hi,
use the following.
dim codegurudb as database
dim mysql as string
set codegurudb = workspaces(0).opendatabase(app.path & "\test.mdb")
'say table name is xxx
mysql = "DROP TABLE xxx"
codegurudb.execute mysql
codegurudb.close
I assume that in project reference you add the DAO.
Santulan
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|