Hi folks,
I'm trying to establish a connection to a MySQL db and populate a listbox with data from a table in the db. I'm trying to trigger this on loading the form.
I haven't done this before as I've previously used linked tables. This time around I've been asked to avoid DSN linked tables.
Any help here would really be appreciated.
Thanks,
Dave
Private Sub Form_Load()
Dim conn As ADODB.Connection
Set conn = New ADODB.Connection
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
conn.ConnectionString = "DRIVER={MySQL ODBC 3.51 Driver};SERVER=SERVERNAME;DATABASE=DBNAME;UID=pcuser;PWD=pcuser;OPTION=3"
conn.Open
rs.Open "SELECT FirstName,Surname FROM EMPLOYEES_Registered", conn, adOpenStatic, adLockReadOnly
Me.Listbox.RowSource = ??
End Sub
I'm trying to establish a connection to a MySQL db and populate a listbox with data from a table in the db. I'm trying to trigger this on loading the form.
I haven't done this before as I've previously used linked tables. This time around I've been asked to avoid DSN linked tables.
Any help here would really be appreciated.
Thanks,
Dave
Private Sub Form_Load()
Dim conn As ADODB.Connection
Set conn = New ADODB.Connection
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
conn.ConnectionString = "DRIVER={MySQL ODBC 3.51 Driver};SERVER=SERVERNAME;DATABASE=DBNAME;UID=pcuser;PWD=pcuser;OPTION=3"
conn.Open
rs.Open "SELECT FirstName,Surname FROM EMPLOYEES_Registered", conn, adOpenStatic, adLockReadOnly
Me.Listbox.RowSource = ??
End Sub