PC Review


Reply
Thread Tools Rate Thread

Deleting a Table

 
 
howard
Guest
Posts: n/a
 
      24th Sep 2003
Hi there

If anyone's able to help me with my Access crashes each
time I try to delete a Table, programmatically, I'd be
most grateful. The code/s I execute to delete a Table is
as below;

Sub myDeleteTable(strTNAME As String)

Dim strPATH As String

strPATH = "C:\DMP_DataBase\September24\DMP_Roy.mdb"
myCallDeleteTable strPATH, strTNAME

End Sub

Sub myCallDeleteTable(strPATH As String, strTNAME As
String)

Dim catDELETE As ADOX.Catalog

Set catDELETE = New ADOX.Catalog
catDELETE.ActiveConnection = _
"Provider=Microsoft.Jet.OLEDB.4.0; " & _
"Data Source=" & strPATH

catDELETE.Tables.Delete strTNAME

Set catDELETE = Nothing

End Sub

Whenever the code gets to the
line: "catDELETE.Tables.Delete strTNAME", it crashes.
Access 2002 comes up with that dialog box that asks if you
want your database repaired, and if you want to send a
report, about the error, to Microsoft.

Please help!

Thanks
H
 
Reply With Quote
 
 
 
 
Dan Artuso
Guest
Posts: n/a
 
      25th Sep 2003
Hi,
No need to do all that.
Use SQL to it for you.

strSql = "DROP TABLE Trainees " & strTNAME

then just execute it.

--
HTH
Dan Artuso, Access MVP


"howard" <(E-Mail Removed)> wrote in message news:0e2f01c38293$4245a610$(E-Mail Removed)...
> Hi there
>
> If anyone's able to help me with my Access crashes each
> time I try to delete a Table, programmatically, I'd be
> most grateful. The code/s I execute to delete a Table is
> as below;
>
> Sub myDeleteTable(strTNAME As String)
>
> Dim strPATH As String
>
> strPATH = "C:\DMP_DataBase\September24\DMP_Roy.mdb"
> myCallDeleteTable strPATH, strTNAME
>
> End Sub
>
> Sub myCallDeleteTable(strPATH As String, strTNAME As
> String)
>
> Dim catDELETE As ADOX.Catalog
>
> Set catDELETE = New ADOX.Catalog
> catDELETE.ActiveConnection = _
> "Provider=Microsoft.Jet.OLEDB.4.0; " & _
> "Data Source=" & strPATH
>
> catDELETE.Tables.Delete strTNAME
>
> Set catDELETE = Nothing
>
> End Sub
>
> Whenever the code gets to the
> line: "catDELETE.Tables.Delete strTNAME", it crashes.
> Access 2002 comes up with that dialog box that asks if you
> want your database repaired, and if you want to send a
> report, about the error, to Microsoft.
>
> Please help!
>
> Thanks
> H



 
Reply With Quote
 
Howard
Guest
Posts: n/a
 
      25th Sep 2003
Hi Dan

Thanks, very much, for your response. I managed to get
round that problem. However, I wonder if you're aware if
Access2002 has issues with ADOX. Codes, like the one
below, which worked fine, previously, begin to make my
system crash.

catADD.ActiveConnection = CurrentProject.Connection
Set tblADD = catADD.Tables(strTBL_to_UPDATE)

This happens when I get to the line "Set tblADD =
catADD.Tables(strTBL_to_UPDATE)"

Or, it could be that I'm overlooking something fundamental
when I use ADOX, in my code?

Thanks and regards
H

>-----Original Message-----
>Hi,
>No need to do all that.
>Use SQL to it for you.
>
>strSql = "DROP TABLE Trainees " & strTNAME
>
>then just execute it.
>
>--
>HTH
>Dan Artuso, Access MVP
>
>
>"howard" <(E-Mail Removed)> wrote in

message news:0e2f01c38293$4245a610$(E-Mail Removed)...
>> Hi there
>>
>> If anyone's able to help me with my Access crashes each
>> time I try to delete a Table, programmatically, I'd be
>> most grateful. The code/s I execute to delete a Table is
>> as below;
>>
>> Sub myDeleteTable(strTNAME As String)
>>
>> Dim strPATH As String
>>
>> strPATH = "C:\DMP_DataBase\September24\DMP_Roy.mdb"
>> myCallDeleteTable strPATH, strTNAME
>>
>> End Sub
>>
>> Sub myCallDeleteTable(strPATH As String, strTNAME As
>> String)
>>
>> Dim catDELETE As ADOX.Catalog
>>
>> Set catDELETE = New ADOX.Catalog
>> catDELETE.ActiveConnection = _
>> "Provider=Microsoft.Jet.OLEDB.4.0; " & _
>> "Data Source=" & strPATH
>>
>> catDELETE.Tables.Delete strTNAME
>>
>> Set catDELETE = Nothing
>>
>> End Sub
>>
>> Whenever the code gets to the
>> line: "catDELETE.Tables.Delete strTNAME", it crashes.
>> Access 2002 comes up with that dialog box that asks if

you
>> want your database repaired, and if you want to send a
>> report, about the error, to Microsoft.
>>
>> Please help!
>>
>> Thanks
>> H

>
>
>.
>

 
Reply With Quote
 
Dan Artuso
Guest
Posts: n/a
 
      25th Sep 2003
Hi,
Sorry, I don't use ADOX very much so I can't confirm that.

--
HTH
Dan Artuso, Access MVP


"Howard" <(E-Mail Removed)> wrote in message news:08b201c38340$fdd24f70$(E-Mail Removed)...
> Hi Dan
>
> Thanks, very much, for your response. I managed to get
> round that problem. However, I wonder if you're aware if
> Access2002 has issues with ADOX. Codes, like the one
> below, which worked fine, previously, begin to make my
> system crash.
>
> catADD.ActiveConnection = CurrentProject.Connection
> Set tblADD = catADD.Tables(strTBL_to_UPDATE)
>
> This happens when I get to the line "Set tblADD =
> catADD.Tables(strTBL_to_UPDATE)"
>
> Or, it could be that I'm overlooking something fundamental
> when I use ADOX, in my code?
>
> Thanks and regards
> H
>
> >-----Original Message-----
> >Hi,
> >No need to do all that.
> >Use SQL to it for you.
> >
> >strSql = "DROP TABLE Trainees " & strTNAME
> >
> >then just execute it.
> >
> >--
> >HTH
> >Dan Artuso, Access MVP
> >
> >
> >"howard" <(E-Mail Removed)> wrote in

> message news:0e2f01c38293$4245a610$(E-Mail Removed)...
> >> Hi there
> >>
> >> If anyone's able to help me with my Access crashes each
> >> time I try to delete a Table, programmatically, I'd be
> >> most grateful. The code/s I execute to delete a Table is
> >> as below;
> >>
> >> Sub myDeleteTable(strTNAME As String)
> >>
> >> Dim strPATH As String
> >>
> >> strPATH = "C:\DMP_DataBase\September24\DMP_Roy.mdb"
> >> myCallDeleteTable strPATH, strTNAME
> >>
> >> End Sub
> >>
> >> Sub myCallDeleteTable(strPATH As String, strTNAME As
> >> String)
> >>
> >> Dim catDELETE As ADOX.Catalog
> >>
> >> Set catDELETE = New ADOX.Catalog
> >> catDELETE.ActiveConnection = _
> >> "Provider=Microsoft.Jet.OLEDB.4.0; " & _
> >> "Data Source=" & strPATH
> >>
> >> catDELETE.Tables.Delete strTNAME
> >>
> >> Set catDELETE = Nothing
> >>
> >> End Sub
> >>
> >> Whenever the code gets to the
> >> line: "catDELETE.Tables.Delete strTNAME", it crashes.
> >> Access 2002 comes up with that dialog box that asks if

> you
> >> want your database repaired, and if you want to send a
> >> report, about the error, to Microsoft.
> >>
> >> Please help!
> >>
> >> Thanks
> >> H

> >
> >
> >.
> >



 
Reply With Quote
 
howard
Guest
Posts: n/a
 
      25th Sep 2003
Thanks, anyway. H.


>-----Original Message-----
>Hi,
>Sorry, I don't use ADOX very much so I can't confirm that.
>
>--
>HTH
>Dan Artuso, Access MVP
>
>
>"Howard" <(E-Mail Removed)> wrote in

message news:08b201c38340$fdd24f70$(E-Mail Removed)...
>> Hi Dan
>>
>> Thanks, very much, for your response. I managed to get
>> round that problem. However, I wonder if you're aware if
>> Access2002 has issues with ADOX. Codes, like the one
>> below, which worked fine, previously, begin to make my
>> system crash.
>>
>> catADD.ActiveConnection = CurrentProject.Connection
>> Set tblADD = catADD.Tables(strTBL_to_UPDATE)
>>
>> This happens when I get to the line "Set tblADD =
>> catADD.Tables(strTBL_to_UPDATE)"
>>
>> Or, it could be that I'm overlooking something

fundamental
>> when I use ADOX, in my code?
>>
>> Thanks and regards
>> H
>>
>> >-----Original Message-----
>> >Hi,
>> >No need to do all that.
>> >Use SQL to it for you.
>> >
>> >strSql = "DROP TABLE Trainees " & strTNAME
>> >
>> >then just execute it.
>> >
>> >--
>> >HTH
>> >Dan Artuso, Access MVP
>> >
>> >
>> >"howard" <(E-Mail Removed)> wrote in

>> message news:0e2f01c38293$4245a610$(E-Mail Removed)...
>> >> Hi there
>> >>
>> >> If anyone's able to help me with my Access crashes

each
>> >> time I try to delete a Table, programmatically, I'd

be
>> >> most grateful. The code/s I execute to delete a

Table is
>> >> as below;
>> >>
>> >> Sub myDeleteTable(strTNAME As String)
>> >>
>> >> Dim strPATH As String
>> >>
>> >> strPATH = "C:\DMP_DataBase\September24

\DMP_Roy.mdb"
>> >> myCallDeleteTable strPATH, strTNAME
>> >>
>> >> End Sub
>> >>
>> >> Sub myCallDeleteTable(strPATH As String, strTNAME As
>> >> String)
>> >>
>> >> Dim catDELETE As ADOX.Catalog
>> >>
>> >> Set catDELETE = New ADOX.Catalog
>> >> catDELETE.ActiveConnection = _
>> >> "Provider=Microsoft.Jet.OLEDB.4.0; " & _
>> >> "Data Source=" & strPATH
>> >>
>> >> catDELETE.Tables.Delete strTNAME
>> >>
>> >> Set catDELETE = Nothing
>> >>
>> >> End Sub
>> >>
>> >> Whenever the code gets to the
>> >> line: "catDELETE.Tables.Delete strTNAME", it crashes.
>> >> Access 2002 comes up with that dialog box that asks

if
>> you
>> >> want your database repaired, and if you want to send

a
>> >> report, about the error, to Microsoft.
>> >>
>> >> Please help!
>> >>
>> >> Thanks
>> >> H
>> >
>> >
>> >.
>> >

>
>
>.
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Deleting from main table instead of sub table sherriross81 Microsoft Access Queries 3 21st Oct 2008 12:54 AM
Deleting records in one table that appear in another table =?Utf-8?B?cmpwaGlsbGlwcw==?= Microsoft Access Form Coding 4 15th Mar 2005 04:39 PM
Deleting links without deleting the table. =?Utf-8?B?Q2FsYXNrYQ==?= Microsoft Access Database Table Design 2 21st Oct 2004 10:33 PM
Deleting out of master table, but retain record in another table Mike Microsoft Access 2 22nd Jan 2004 07:56 PM
Index out of range error when deleting rows in dataset table with relationships defined between fields in the same table JerryK Microsoft ADO .NET 0 19th Sep 2003 06:17 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:02 PM.