Ver Mensaje Individual
  #1 (permalink)  
Antiguo 16/10/2012, 09:46
Carol_84
 
Fecha de Ingreso: septiembre-2007
Mensajes: 234
Antigüedad: 16 años, 7 meses
Puntos: 1
Pregunta Auyda con VBA y MYSQL

Hola:
tengo el siguiente problema.
Estoy utilizando VBA para hacer una interfaz desde el excel.
Resulta que tengo qur conectar vba con Mysql y para eso he hecho lo siguiente:







Private Sub CommandButton1_Click()
'Check to see if data is entered into the UserName combo box
If IsNull(cboUser) Or cboUser = "" Then
MsgBox "You must enter a User Name.Required Data"
Me.cboUser.SetFocus
Exit Sub
End If

'Check to see if data is entered into the password box
If IsNull(txtPassword) Or txtPassword = "" Then
MsgBox "You must enter a Password.Required Data"
Me.txtPassword.SetFocus
Exit Sub
End If


Dim oConn As ADODB.Connection
Dim rs As ADODB.Recordset

oConn = New ADODB.Connection
oConn.Open "DRIVER={MySQL ODBC 5.1 Driver};" & _
"SERVER=localhost;" & _
"DATABASE=MYBD;" & _
"USER=root;" & _
"PASSWORD=1234;" & _
"Option=3"
End Sub




Pero no me funciona.
Puedes ayudarme , por favor? he instalado el driver MySQL ODBC 5.1 Driver pero nada, no me funciona. El error que me da es :


user-defined type not defined. Y en concreto me da en la linea Dim oConn As ADODB.Connection
gracias