Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB Databases Basics
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
VB Databases Basics Beginning-level VB coding questions specific to using VB with databases. Issues not specific to database use will be redirected to other forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB Databases Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old February 2nd, 2006, 01:01 PM
Registered User
Join Date: Feb 2006
Location: Nottingham, , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default drop Oracle table from VBA excel


I am strugling to run an Oracle procedure that drops a table from within an excel VBA script. The script returns an invalid ODBC connection 'ODBC--connection to Database failed' error '3151'.

I am wandering if I can run this kind of procedures from VBA? Before I ran some procedures that delete or insert records but this is the first time I'm trying to drop a table.

the script I'm using is this

Function droptab()
Dim db As Database, LConnect As String, ws As Workspace, LSProc As QueryDef


Set ws = DBEngine.Workspaces(0)

Set db = ws.OpenDatabase("", False, False, LConnect)

Set LSProc = db.CreateQueryDef("")
LSProc.Connect = LConnect

LSProc.Sql = "BEGIN droptabs; END;"
LSProc.ReturnsRecords = False
LSProc.ODBCTimeout = 0
Set LSProc = Nothing
CallSProc = True

Set db = Nothing

End Function

Any ideas?

Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Code works in Excel VBA but not Access VBA fossx Access VBA 2 May 21st, 2007 08:00 AM
Help Needed to write vba for Pivot Table in Excel sunny76 Excel VBA 1 June 28th, 2005 01:44 AM
(oracle 8i)Alter Table <table> coalesce partition combo Oracle 3 October 13th, 2004 09:35 AM
Writing to an Oracle table from Excel emad100 Excel VBA 0 October 29th, 2003 10:24 AM

All times are GMT -4. The time now is 11:57 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.