I am creating a combo box with a button. In the below vba code, I am getting the string from the combo box. Then, I am trying to use SQL to the corresponding distro lists in the table (same row). This VBA code below is getting a Run-time error '438' Object doesn't support this property or method and it points to the SQL statment in the debugging screen. Any help is greatly appreciated.
Code:Private Sub Command11_Click() Dim cnn As ADODB.Connection Dim rs As ADODB.Recordset Dim SQL As String Dim vFld As Variant string1 = Combo27.Value SQL = "SELECT [" & DistributionLists & "] as Fld" & _ " FROM " & DistroLists & " WHERE " & string1 & "=" & Application rs.Open SQL vFld = rs!Fld Set cnn = Nothing Set rs = Nothing MsgBox (vFld) End Sub