MySQL Forums :: Connector/ODBC :: VBA connection to MySQL

Advanced Search

VBA connection to MySQL
Posted by: richard edwards ()
Date: February 20, 2009 05:37AM

I have created my connection MySQL with the following code:

Dim oConn As ADODB.Connection
Dim rs As ADODB.Recordset
Private Sub ConnectDB()
Set oConn = New ADODB.Connection
oConn.Open "DRIVER={MySQL ODBC 5.1 Driver};" & _
"SERVER=localhost;" & _
"USER=USER1" & _
End Sub

and am planning to extract the data with:

Private Sub PullData()
Set rs = New ADODB.Recordset
strSQL = "select FIELD1, FIELD2, FIELD3 from DATABASE1.TABLE1 where FIELD4='xxx' order by date;"
'rs.Open strSQL, oConn, adOpenDynamic, adLockOptimistic
End Sub

i do not receive any errors when i run it so i presume all ok.

my questions are:
how do i pass the variable xxx from a cell in excel?
how do i even return this data into excel once i have it?

thanks very much all


Options: ReplyQuote

Subject Written By Posted
VBA connection to MySQL richard edwards 02/20/2009 05:37AM
Re: VBA connection to MySQL Jay Alverson 02/20/2009 08:43AM
Re: VBA connection to MySQL Bertalan Danko 02/28/2009 08:06PM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.