LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Using ODBC function calls

I am trying to connect to an ODBC data source using VBA and I am
running into problems. The main problem occurs when my code queries a
table that isn't in the database. I'd like to just receive an error
and then respond to the error, but that isn't happening. As soon as the
query is attempted, it brings the computer to a complete halt with no
error codes. I am thinking that I need to get into using ODBC function
calls to interact with the database, but I am inexperienced using API
functions. I was just wondering if anyone could post some example code
using ODBC function calls.

Thanks.


FWIW, I am connecting like this:
----------------------------------------------------
Set wrkDBE = DBEngine.CreateWorkspace("tempWS", "admin", vbNullString)
Set condbs = wrkDBE.OpenDatabase("", 0, 0, "ODBC;DSN=insite;")
If Err.Number = 3151 Then Exit Sub

For Each tblObj In condbs.TableDefs
If Err.Number = 3146 Then Exit Sub
If tblObj.Name Like "* Info<Bag" Then

Blah Blah Blah

condbs.Close
wrkDBE.Close

And like this:
---------------------------------------
Set wrkODBC = CreateWorkspace("ODBCWorkspace", "", "", dbUseODBC)
Set condbs = wrkODBC.OpenDatabase("ODBC;DSN=insite;")

Set rst(0) = condbs.OpenRecordset("SELECT * FROM ADI.""" & WellName
& _
SqlSep & WellBased & SqlSep & "Well Info<Bag""")

condbs.Close
wrkODBC.Close

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
using strings in vlookup function calls AtTheEndofMyRope Excel Worksheet Functions 5 August 30th 09 07:06 PM
VBA: How to pass arrays in Function Calls? Mac Lingo[_2_] Excel Programming 4 November 1st 05 06:26 PM
worksheet function calls between worksheets Joe Excel Programming 0 April 29th 04 03:21 PM
identifying which cell calls my VBA function. y Excel Programming 3 April 26th 04 04:32 AM
function calls Claude Excel Programming 2 December 5th 03 01:55 PM


All times are GMT +1. The time now is 01:52 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"