Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 510
Default Excel-SQL Connect

Hi

Haven't never made it such way myself. I create a ODBC query
(Data.GetExternalData), then write a procedure, which is changing the query
obect's CommandText property and then invokes refresh event, and attach it
to button from Forms toolbar. And usually I set data to be refreshed on open
(Data Range Properties). But I think when you need to change the connection
through code, then QueryTable.Connection must be the property to meddle
with. You have to read it somehow at first - then you'll know how to change
it.


--
(When sending e-mail, use address )
Arvi Laanemets


"Michael Schreiber" wrote in message
...
Thank you for the hint.

Now i now that i must connect through a VBA Macro.

I use the myodbc3 driver to connect to the database.
It works fine within excel as data-source.

But i can't manage to connect to the database through VBA.

Sub Daten_importieren()

Dim myconn As New Connection
Dim myrec As New Recordset
Dim mySQL As String
Dim myrow As Long

Dim sql$
Set ws = ThisWorkbook.Worksheets("Tabelle1")


conn.Open
"Provider=MSASQL;Driver=MySQL;Server=x.x.x.x,UID=r oot,PDW=****,database=a
uswertung"

sql = "SELECT auslastung_0.zeit, auslastung_0.usr, auslastung_0.sys,
auslastung_0.wio, auslastung_0.idle FROM auswertung.auslastung
auslastung_0"

rec.Open sql.conn
End Sub

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

End Sub

Get an error that Connection is not defined ...

thx mike

"Arvi Laanemets" wrote in
:

Hi

Lately I answered to similar question in NG microsoft.public.de.excel.
The thread was 'Excel in Verbindung mit Datenabnk benutzen', started
by Wolfgang Dausend at 30.10.2003 12:22. Maybe you get some ideas.





Reply
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
How to connect excel(If I consider it as a database) with a websit SATABDI NATH Excel Discussion (Misc queries) 0 July 8th 08 12:34 PM
Excel cannot connect to web Ltat42a Excel Discussion (Misc queries) 0 May 29th 06 05:18 PM
How to connect two columns in Excel VBA?? [email protected] Excel Worksheet Functions 4 November 12th 05 11:26 AM
connect a form to excel database Kathy Excel Discussion (Misc queries) 5 October 10th 05 06:17 AM
Informatica Connect to Excel workbook Michael MacLachlan Excel Discussion (Misc queries) 0 December 3rd 04 11:15 AM


All times are GMT +1. The time now is 04:15 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"