Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.
Sub GetBom_Click() Dim strPart As String Dim cn As ADODB.Connection Dim strSQL As String Dim rs As ADODB.Recordset Dim strConn As String Dim qt As QueryTable Set cn = New ADODB.Connection Worksheets("M2MBom").Activate strPart = Worksheets("M2MBOM").Range("B1") strConn = "PROVIDER=SQLOLEDB; DATA SOURCE=MyServer; INITIAL CATALOG=Database01; USER ID=test; Password=test" 'This procedure requires one parameter (i also tested with another proc requiring no variables, does not work strSQL = "Proc_Get_Item strPart" cn.Open strConn Set rs = New ADODB.Recordset Set rs.ActiveConnection = cn rs.Open strSQL, cn, adOpenForwardOnly, adLockReadOnly 'Here the connection state is 1 MsgBox cn.State 'Here the rs state is 0 MsgBox rs.State If rs.State = adStateOpen Then If rs.BOF And rs.EOF Then MsgBox "This Part Number does not have a Bill of Materials." Exit Sub End If Range("A2:AZ500").Select Selection.ClearContents ActiveSheet.Range("A2").CopyFromRecordset rs rs.Close Set rs = Nothing Else MsgBox "Unable to open recordset. Please notify adminsitrator." End If cn.Close Set cn = Nothing End Sub
|Excel writer in php that allows file save, NOT download||3||24|
|bit defender blocks good applications||2||32|
|Excel Formula - certain part of string||2||23|
|Access 2013 combo box not working||3||11|
Join the community of 500,000 technology professionals and ask your questions.
Connect with top rated Experts
22 Experts available now in Live!