View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
AL AL is offline
external usenet poster
 
Posts: 37
Default xlodbc returning no rows & no errors

I'm not familiar with Oracle SQL syntax, but from my
experience, you might want to check that you are entering
the Correct TYPE for the NI code. For instance, try
enclosing the NI code in single quotes.


-----Original Message-----
Have added in xlodbc.xla in Excel SR1 and inserted

following code in to
activate worksheet

Private Sub Worksheet_Activate()
Dim Chan As Variant
Chan = SQLOpen("DRIVER={Microsoft ODBC for
Oracle};UID=username;PWD=password;SERVER=serverna me;")
If IsError(Chan) Then
XLODBCErrHandler
Exit Sub
End If
SQLExecQuery Chan, _
"SELECT CUST_PERSONAL_DETAILS.CUSTP_CUST_SEQNO,
CUST_PERSONAL_DETAILS.CUSTP_NI_CODE FROM

SUMMIT.CUST_PERSONAL_DETAILS WHERE
(CUST_PERSONAL_DETAILS.CUSTP_NI_CODE=[Enter the NI Code])"
If IsError(Chan) Then
XLODBCErrHandler
Exit Sub
End If
SQLRetrieve Chan, ActiveSheet.Range("B3"), , , True
If IsError(Chan) Then
XLODBCErrHandler
Exit Sub
End If
SQLClose (Chan)
End Sub
Sub XLODBCErrHandler()

Dim ErrMsgs As Variant
Dim ErrCode As Variant

' Call SQLError to return error values to the variant
' ErrMsgs.
ErrMsgs = SQLError()

' Display each item in the ErrMsgs variant array.
For Each ErrCode In ErrMsgs
MsgBox ErrCode
Next

End Sub

My problem is that for some NI codes it returns no data

but I know the rows
exist on the oracle database. The error handling throws

up no errors. I'm an
oracle dba playing at using Excel for the first time and

would appreciate any
help you can give.

--
S Boulton
.