View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Volker Jahn Volker Jahn is offline
external usenet poster
 
Posts: 2
Default Excel database access

Hello NG,

I'm having severe problems accessing a Sybase-Database from within Excel
via a local ODBC-Connection. The Connection itself is working fine,
Excel (VBA) reads and exports data without problems. One problem appears
to be with refreshing a query in a selected range.

set qtQtrResults1 = ActiveWorkbook.Worksheets("first").QueryTables(1)
With qtQtrResults1
.CommandType = xlCmdSql
.CommandText = "SELECT * FROM DBA.st_partie_as; "
.Refresh
End With

The application stops executing with Error 1004, not too precise!!! The
debugger points out the .Refresh statement. Commenting it out helps, but
then the desired functionality ist gone. Funny thing: I do this for
several times in a project, based on the query results of the first
query a ListBox (ComboBox) ist filled, changing of the ComboBox
triggeres another query, ... . Execution stops at the second query,
never on the first one. I tried DoEvent before filling the ListBox, no
result.

Also tried a different approch using the XLODBC-plugin. Problem he is
there a way to determine the number of lines of a query-result? I want
everything below the query result to move down that number of lines.
Also according to the Helpfile this plugin is depreciated ("Don't use
this and other functions of XLODBC, rather use the ADO dataset
functions!!! Get help <here"). Clicking <here has the result that
ADO-Help is not installed, despite a full installation of Office2000
Professional.
Where DO I get information on ADO? Could it be that this functionality
is not included in my version ov Office2000? At least there is not hint
at installation time about ADO.

help is very appreciated
thanks

Volker