View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
bwreath[_3_] bwreath[_3_] is offline
external usenet poster
 
Posts: 1
Default Examples of Using VBA, ODBC, and mysql

Hi,

thanks for the suggestion.
I have two questions actually.

1) This is the code that I have so far and I was wondering how
I would involve the concept of recordset.

2) My other question is that I want to use ODBC and not ADO.
I would like to know in the
Tools
References part of Excel what reference should I check off to be
able to use all of the ODBC objects and references?

Below is the code that I am using so far.

thanks very much.

With ActiveSheet.QueryTables.Add(Connection:=Array(Arra y( _
"ODBC;DSN=myquery;DESC=MySQL ODBC 3.51 Drive
DSN;DATABASE=mydatabase;SERVER=123.456.78.90;UID=m yacc;PASSWORD=mypasswd;PORT=3306;O
_
), Array("PTION=3;STMT=;")), Destination:=Range("A1"))
.CommandText = Array( _
"Select acc_num FROM mytable WHERE acc_id=12121" _
)
.Name = "Query from myquery"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = True
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.PreserveColumnInfo = True
.Refresh BackgroundQuery:=False
End Wit

--
Message posted from http://www.ExcelForum.com