473,516 Members | 3,488 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

drop Microsoft Access XP table with Visual Basic

Dear developer,
I have an error message when I try to delete or drop Microsoft Access XP
table with ADOX in Visual Basic 6. I use the ADOX.Catalog and ADOX.table to
create and delete or drop table within Visual Basic program.
If anybody knows how to solve the problem, please give me the solution.
I would like to thank you for your attention and response.

Best regard,

Sanad
Jul 21 '05 #1
8 5654
delete table with Visual Basic 6 wrote:
Dear developer,
I have an error message when I try to delete or drop Microsoft Access
XP table with ADOX in Visual Basic 6. I use the ADOX.Catalog and
ADOX.table to create and delete or drop table within Visual Basic
program.
If anybody knows how to solve the problem, please give me the
solution.
I would like to thank you for your attention and response.


Hello,
What's the error message you're getting?
Jul 21 '05 #2
Hi,

This is a wrong newsgroup for vb 6 (this is *dotnet*).
Anyway, what error do you get?
Maybe the table in question is referenced by another table and thus can't be
dropped?

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
SLODUG - Slovene Developer Users Group
www.rthand.com

"delete table with Visual Basic 6" <delete table with Visual Basic
6@discussions.microsoft.com> wrote in message
news:E4**********************************@microsof t.com...
Dear developer,
I have an error message when I try to delete or drop Microsoft Access XP
table with ADOX in Visual Basic 6. I use the ADOX.Catalog and ADOX.table
to
create and delete or drop table within Visual Basic program.
If anybody knows how to solve the problem, please give me the solution.
I would like to thank you for your attention and response.

Best regard,

Sanad

Jul 21 '05 #3
My error message is "Run time error '3265': Item cannot be found in the
collectioin corresponding to the requested name or ordinal". But when I check
my database, the table to be deleted is exist. And also the name is excactly
the same with the value of the variable DelCodeNumber.
Here is the code:
Dim catStok As New ADOX.Catalog
Dim tblStok As New ADOX.Table

catStok.ActiveConnection = "Provider=Microsoft.Jet.OLEDB.4.0;" &
"Data Source=C:\dbStok.mdb;"
tblStok.Name = DelCodeNumber
catStok.Tables.Delete tblStok
Set catStok.ActiveConnection = Nothing
Set catStok = Nothing

Thank you very much for your attention

Best Regard,

Sanad
"Leon Mayne [MVP]" wrote:
Hello,
What's the error message you're getting?


Jul 21 '05 #4
delete table with Visual Basic 6 wrote:
Dim catStok As New ADOX.Catalog
Dim tblStok As New ADOX.Table

catStok.ActiveConnection =
"Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=C:\dbStok.mdb;"
tblStok.Name = DelCodeNumber
catStok.Tables.Delete tblStok
Set catStok.ActiveConnection = Nothing
Set catStok = Nothing


Have you stepped through to check the value of DelCodeNumber to make sure
it's correct?
Jul 21 '05 #5
I have stepped through to check the value of DelCodeNumber, and the value I
use is "1", because indeed the table name I create in the database is a kind
of code number, like "1" , "12" , "25", "314", etc.
So the value of variable DelCodeNumber is "1", not "1.tbl". I had use the
"1.tbl" but the result is the same.

catStok.ActiveConnection = "Provider=Microsoft.Jet.OLEDB.4.0;" &
"Data Source=C:\dbStok.mdb;"
tblStok.Name = NoKodeDel + ".tbl"

catStok.Tables.Delete tblStok --> Here the program stop running

Set catStok.ActiveConnection = Nothing
Set catStok = Nothing

I use Visual Basic 6 within Visual Studio 6 Enterprise Edition, and Ms
Access XP.
If you have a better or another way just to delete / drop Ms Access XP table
with Visual Basic 6, let me know. Or may be have I to use Ms Access 97 and
use DAO ?

Thank you very much for your attention.

"Leon Mayne [MVP]" wrote:
Have you stepped through to check the value of DelCodeNumber to make sure
it's correct?

Jul 21 '05 #6
Finally, I get the answer!!!
I get the answer in the Visual Basic-database.ado section in this newsgroup
date 4/1/2005 by Brendan Reynolds.
Thank you again for Mr.Brendan Reynolds.

The answer is:

"If the function returns True, call Catalog.Tables.Delete YOURTABLENAME to
delete the table."

My mistake is

Dim tblStok As New ADOX.Table

tblStok.Name = DelCodeNumber
Catalog.Tables.Delete tblStok --> error

Catalog.Tables.Delete DelCodeNumber --> correct

By the way, I appreciate Mr. Leon Mayne for the VERY FAST attention and
answer. And also thank you for Mr.Miha Markic for the advice and forgiveness.

All right, have a nice work. Your work means a lot for us.

Best regard,

Sanad
Jul 21 '05 #7
delete table with Visual Basic 6 wrote:
Finally, I get the answer!!!


Glad you found the answer. Sorry I couldn't help earlier.
Jul 21 '05 #8
On Mon, 10 Jan 2005 02:15:04 -0800, "delete table with Visual Basic 6" <delete table with Visual
Basic 6@discussions.microsoft.com> wrote:

¤ Dear developer,
¤ I have an error message when I try to delete or drop Microsoft Access XP
¤ table with ADOX in Visual Basic 6. I use the ADOX.Catalog and ADOX.table to
¤ create and delete or drop table within Visual Basic program.
¤ If anybody knows how to solve the problem, please give me the solution.
¤ I would like to thank you for your attention and response.
¤

BTW, you can also use Access SQL DDL:

DROP TABLE TableName
Paul ~~~ pc******@ameritech.net
Microsoft MVP (Visual Basic)
Jul 21 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2936
by: Novice | last post by:
Hi all, I am a C++ and Java developer with over 3 years of industry experience. I've written low level C++ code, in addition to web clients that use web services. I've just recently installed the Visual Studio .net Professional trial version 2003. I have been reading up various documents that discuss - "What is Microsoft .Net" and have...
8
20814
by: WindAndWaves | last post by:
Hi everyone, Has anyone got any experience with drop and drag in Access? I would like to make a calendar style form where my users can drop and drag appointments.... I am using Access 2003 and I have access to .net and the like, but I would really like to keep it simple.
3
26260
by: Stephen Adam | last post by:
Hi there, I'm sure i'm missing something really simple here, all i want to do is get the value of the selected item in a list box. Even after much fiddling about last night I still could not get my code to work. Below is some code which highlights my problem. All I want to do is set the lable control's text property to the value of the...
10
22711
by: Geoff Jones | last post by:
Hi I'm trying to drop a table by using: Dim cmd As New OleDbCommand("DROP TABLE IF EXISTS books", myconnection) cmd.ExecuteNonQuery() but I get a syntax error: "Syntax error in DROP TABLE or DROP INDEX"
182
7357
by: Jim Hubbard | last post by:
http://www.eweek.com/article2/0,1759,1774642,00.asp
8
280
by: delete table with Visual Basic 6 | last post by:
Dear developer, I have an error message when I try to delete or drop Microsoft Access XP table with ADOX in Visual Basic 6. I use the ADOX.Catalog and ADOX.table to create and delete or drop table within Visual Basic program. If anybody knows how to solve the problem, please give me the solution. I would like to thank you for your attention...
2
1904
by: shaznay2 | last post by:
I need some help! I'm trying to set up two drop down menus where the first displays the Department and the second displays the names of the printers found in the department. So far i have two tables, one called tbldepartment and the other called tblname. Tbl department has 2 fields in it which are ID and department name(i've set ID to...
5
13730
by: Romulo NF | last post by:
Greetings, I´m back here to show the new version of the drag & drop table columns (original script ). I´ve found some issues with the old script, specially when trying to use 2 tables with drag&drop on the same page (which was not possible). Now i´ve a new concept of the script, more object oriented. I´ve also commented the whole code so you...
0
7273
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7574
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7547
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5712
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5106
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3265
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3252
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
823
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
487
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.