Shadowshiroy
New Member
- Joined
- Jul 18, 2023
- Messages
- 3
- Office Version
- 365
- Platform
- Windows
I am trying to display the data of a column in my MariaDB server into a userform in Excel but I cannot assign properly the values to the Combobox. I would really appreciate any type of help
VBA Code:
Private Sub ComboBox1_Change()
Dim con As ADODB.Connection
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
Set con = New ADODB.Connection
con.Open "DRIVER={MariaDB ODBC 3.1 Driver};SERVER=10.5.17.100;PORT=XX;DATABASE=XX;UID=XX;PWD=XX;"
Set tipus = con.Execute("SELECT tipusprojecte FROM tipusprojecte;")
con.Execute Sql
rs.Open Sql, con
ComboBox1.DataSource.CopyFromRecordset rs
rs.Close
con.Close