Dear Experts,
I am using following procedure to run a sql procedure dbo.CalcItemCost.
>>> use code - tags <<<
The procedure is running absolutely fine and showing the results in excel sheet "1-GetItemCost" starting from Cell Ref. A7. The parameters ItemCode & VariantCode which needs to be passed to procedure dbo.CalcItemCost are specified in cells B3 & B4 Respectively.
Now, I need to run another sql procedure naming dbo.CalcItemCost_Detailed in which i wish to pass same parameters i.e. ItemCode & VariantCode to be picked from cells B3 & B4 and display the recordset starting from cell ref. A15 as shown in below image of my excel sheet.
Can anybody help me in executing above task? Thanks for your assistance in advance.
Mpapreja
I am using following procedure to run a sql procedure dbo.CalcItemCost.
>>> use code - tags <<<
Code:
Private Sub cmdApplyFilter_Click()
Dim ItemCode As Variant
Dim VariantCode As Variant
ItemCode = Sheets("1-GetItemCost").Range("B3").Value 'Pass value from cell B3 to SellStartDate variable
VariantCode = Sheets("1-GetItemCost").Range("B4").Value
With ActiveWorkbook.Connections("CalcItemCostConnection").OLEDBConnection
.CommandText = "EXEC dbo.CalcItemCost '" & ItemCode & "','" & VariantCode & "'"
ActiveWorkbook.Connections("CalcItemCostConnection").Refresh
End With
End Sub
The procedure is running absolutely fine and showing the results in excel sheet "1-GetItemCost" starting from Cell Ref. A7. The parameters ItemCode & VariantCode which needs to be passed to procedure dbo.CalcItemCost are specified in cells B3 & B4 Respectively.
Now, I need to run another sql procedure naming dbo.CalcItemCost_Detailed in which i wish to pass same parameters i.e. ItemCode & VariantCode to be picked from cells B3 & B4 and display the recordset starting from cell ref. A15 as shown in below image of my excel sheet.
Can anybody help me in executing above task? Thanks for your assistance in advance.
Mpapreja
Last edited by a moderator: