wrote in message
> Hello,
> we are working with excel vba and we are quering data from DB2 using
> odbc driver from IBM.
> This works without a problem as long as I do no mistake (syntax for
> example). But if my sql-syntax is not correct, the makro crashes. I
> don't know how to catch the error code from DB2. I even don't know if
> there is an error code sent through odbc back to excel. And if so how
> to query this error code.
>
> If anyone has suggestions, I'd be very thrilled.
> Thanks
> Markus
>
> P.S.:
> The vba code I use looks like this:
>
> With ActiveSheet.QueryTables.Add(Connection:= _
> connect_string, Destination:=Range("A5"))
> .CommandText = Array(sql_string)
> .AdjustColumnWidth = False
> .Refresh BackgroundQuery:=False
> End With
>
> where sql_string and connect_string are variables which of course were
> filled before.
>
Lookup "On Error" in the online Excel VBA Editor.
Lookup DAO "Error" and "Errors" on the MSDN CD or Website
(Exact navigation depending on Office and DAO Versions)
hth
-ralph
>> Stay informed about: how to error code from DB2 communication area!