I answered this in one of your cross-posts. You simply need to use concatenation to build your SQL string. As I had posted before:
Of course the actual code with the build SQL string would typically be in a UserForm's Command Button Click event where TextBox1 and TextBox2 controls contain the values needed.Code:Dim s as string s = "Select * from Employee_Database where Employee = '" & TextBox1.Value & "' and Department = '" & TextBox2.value & "'" MsgBox s
Besides the ADO method that ExcelFox showed, a similar QueryTables can be used:
Creating Dynamic Reports with Query Tables in Excel




Reply With Quote

Bookmarks