tyedyejenn
Programmer
I am trying to Select only records that match an account number. Here is the code I have, it selects all the records from the table but I can't figure out how to select only the record I want <br>Please help--Thanks Jenn<br><br>Dim cnn1 As ADODB.Connection<br>Dim cmdAccountCheck As ADODB.Command<br>Dim rsAccountCheck As ADODB.Recordset<br><br>Dim strCnn As String<br><br>'open the connection<br>Set cnn1 = New ADODB.Connection<br><br>strCnn = "Provider=MSDASQL.1;Password=hrrs;Persist Security Info=True;User ID=Adm;Data Source=EricsDrive"<br><br>cnn1.Open strCnn<br><br>Set cmdAccountCheck = New ADODB.Command<br><br>Set cmdAccountCheck.ActiveConnection = cnn1<br><br>'cmdAccountCheck.CommandText = "SELECT Customer_File.[Nam], Customer_File.[Phone1] From Customer_File WHERE Customer_File.[CustNo]=" & "'" & strCasAcctNumber & "'" & ""<br><br>'cmdAccountCheck.CommandType = adCmdStoredProc<br><br><br>Set rsAccountCheck = New ADODB.Recordset<br><br><br>rsAccountCheck.Open "Customer_File", cnn1, adOpenKeyset, adLockOptimistic<br><br>When I uncomment the cmdAccountCheck.CommandText I get errors, I am new to ADO so any help is greatly appreciated<br>Thanks Again--Jenn