Tema: Conectar....
Ver Mensaje Individual
  #1 (permalink)  
Antiguo 16/10/2012, 09:56
Carol_84
 
Fecha de Ingreso: septiembre-2007
Mensajes: 234
Antigüedad: 16 años, 7 meses
Puntos: 1
Exclamación Conectar....

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:
Código vb:
Ver original
  1. Private Sub CommandButton1_Click()
  2.     'Check to see if data is entered into the UserName combo box
  3.    If IsNull(cboUser) Or cboUser = "" Then
  4.         MsgBox "You must enter a User Name.Required Data"
  5.         Me.cboUser.SetFocus
  6.         Exit Sub
  7.     End If
  8.    
  9.     'Check to see if data is entered into the password box
  10.    If IsNull(txtPassword) Or txtPassword = "" Then
  11.         MsgBox "You must enter a Password.Required Data"
  12.         Me.txtPassword.SetFocus
  13.         Exit Sub
  14.     End If
  15.    
  16.  
  17.    Dim oConn As ADODB.Connection
  18.    Dim rs As ADODB.Recordset
  19.  
  20.    oConn = New ADODB.Connection
  21.    oConn.Open "DRIVER={MySQL ODBC 5.1 Driver};" & _
  22.                "SERVER=localhost;" & _
  23.                "DATABASE=MYBD;" & _
  24.                "USER=root;" & _
  25.                "PASSWORD=1234;" & _
  26.                "Option=3"
  27. 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

Última edición por gnzsoloyo; 16/10/2012 a las 11:46 Razón: Etiquetado incorrecto