Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Find Linked table and delete it!

Status
Not open for further replies.

AT76

Technical User
Apr 14, 2005
460
US
Hi,

I have some code that finds a table and deletes it from access; however, I'm trying to delete an oracle linked table and not being successful. Here's what I have:
Function X
If tableExists("" & tabName & "") Then
DoCmd.DeleteObject acTable, "" & tabName & ""
Debug.Print "Deleting table:"; tabName; ""
Else
End If
End Function

Private Function tableExists(table As String) As Boolean
On Error GoTo no
CurrentDb.OpenRecordset (table)
tableExists = True
GoTo theend
no:
tableExists = False
theend:
End Function

Any ideas as to why this would be? Thank you!
 
You first need to establish a connection,
to your Oracle database.
Which, I don't know how to do.
Something like this???

Dim conn as New ADODB.Connection


'???????
.ConnectionString = "Driver={Microsoft ODBC for Oracle};" & _
"Server=OracleServer.world;" & _
"Uid=FDM;" & _
"Pwd=NOTFDM"


strProvider = "Provider =MSDAORA.....???

strDataSource = "Data Source=" & "C:\Oracle\Home\Dbase.ocd



strConn = strProvider & strDataSource

Conn.open strConn

Conn.Execute "DROP TABLE tblName"

Conn.Close: set con = Nothing

...something like that.
Point is, you must first establish a connection, to the oracle DBase.

Good luck.
 
Yes, because it's a linked file.
It's not part of the current file.

AT LEAST TO DELETE, the actual table, not just the link

Otherwise, you would use,

CurrentProject.Connection.EXECUTE "DrOP TABLE... or
CurrentDB.Execute "DROP TABLE... or
Docmd.RunSQL "DROP TABLE....

again, these will only delete the link to the current database,
not the actual table that resides elsewhere
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top