Trying to get data from Access to Excel. This is working fine but...
With Recordset
Source = "SELECT Field1, Field2, Field3, Field4, Field5 FROM table1" & _
"WHERE criteria = " & Worksheets("SomeName").cboBox1 & ";"
.Open Source:=Source, ActiveConnection:=Connection
End With
Range("A5").Offset(1, 0).CopyFromRecordset Recordset
...When i´m trying to insert 1 combobox more it´s not working. I tried this:
With Recordset
Source = "SELECT Field1, Field2, Field3, Field4, Field5 FROM table1" & _
"WHERE criteria = " & Worksheets("SomeName").cboBox1 & " AND " & Worksheets("SomeName").cboBox2 & ";"
.Open Source:=Source, ActiveConnection:=Connection
End With
' Write Recordset
Range("A5").Offset(1, 0).CopyFromRecordset Recordset
It's only taking criteria from the first combobox