LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default function to call an ODBC query...

OK - here's what I've got so far:-

_____
Public Function IPLookup(ipadd As String) As Variant

Dim sqlString As String
Dim objConn As ADODB.Connection
Dim objRS As ADODB.Recordset

sqlString = "SELECT <valid stuff FROM <valid stuff WHERE <valid
stuff='" & ipadd & "' "

objConn.ConnectionString =
"ODBC;DSN=blah;UID=blah;PWD=blah;APP=Microsoft Office
2003;WSID=blah;DATABASE=blah;"

objConn.Open

Set objRS = New ADODB.Recordset
Set objRS = objConn.Execute(sqlString)

IPLookup = objRS(0).Value

'Release the recordset and connection
objRS.Close
objConn.Close
Set objRS = Nothing
Set objConn = Nothing

End Function
____

this just returns #Value for input parameters i know are correct.

is thtis a type-mismatch issue, or am i missing something else?

Thanks,

Neil.



 
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 SUM function in MS QUERY with ODBC Francois via OfficeKB.com Excel Discussion (Misc queries) 0 November 29th 07 02:37 PM
SQL Query, Can you embed a function call? SaeOngJeeMa Excel Discussion (Misc queries) 0 December 3rd 06 07:51 PM
SQL Query, Embedding a Function Call SaeOngJeeMa Excel Discussion (Misc queries) 0 December 1st 06 11:52 PM
Problem with .Background Query option of ODBC Query Shilps Excel Programming 0 April 19th 04 06:41 AM
ODBC Call failed Error 3146 only on some PC's Jay_44 Excel Programming 3 October 7th 03 05:53 PM


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

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"