Hi,
I use the following code to search for article numbers in a textfield on a form, in a sql database and return the price.
But what If I would like to search for serveral article numbers at the same time from a range of cells on the active sheet and return all prices and print them on the same row as each article number but in a different column?
Would much appreciate the help!
'Query
SQLStr = "SELECT convert(money, poCost) FROM [dbo].[AVKParmenItemExportItemNoBid] WHERE MfrPartNbr LIKE '%" & txtProdDescr.Value & "%'"
Set Cn = New ADODB.Connection
With Cn
.CursorLocation = adUseClient
.Open "Driver={SQL Server};Server=" & Server_Name & ";Database=" & Database_Name & _
";Uid=" & User_ID & ";Pwd=" & Password & ";"
Set rs = .Execute(SQLStr)
End With
With rs
Set .ActiveConnection = Nothing
K = .Fields.Count '
r = .RecordCount
vaData = .GetRows
End With
rs.Close
Cn.Close
Bookmarks