m_vishal_c
Board Regular
- Joined
- Dec 7, 2016
- Messages
- 209
- Office Version
- 365
- 2016
- Platform
- Windows
Hi,
i have "Run time error no value given for one or more required parameters" on execute statement in vba
I am trying to connect Excel as database. i am going to execute update query from one excel workbook.
Please guide me. it gives me error while execute this above statement
heaps thanks
i have "Run time error no value given for one or more required parameters" on execute statement in vba
I am trying to connect Excel as database. i am going to execute update query from one excel workbook.
Code:
Public con_daily As Connection
Public con_ele As Connection
Public com_daily As Command
Public com_ele As Command
Public rs_daily As Recordset
Public rs_ele As Recordset
Private Sub cmdUpdate_Click()
Dim lastRow As Long
Dim rng, c As Range
Dim i, iValue As Integer
Set con_daily = New ADODB.Connection
Set con_ele = New ADODB.Connection
With con_daily
.Provider = "Microsoft.ACE.OLEDB.12.0"
.ConnectionString = "Data Source=C:\Users\abc\Documents\Test for abc auto upload\temp\Template_BOMBOQ_MDU.xlsx;Extended Properties=""Excel 12.0 Xml;ReadOnly=0;HDR=YES"";"
.Open
End With
With Worksheets("Sheet1")
lastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
Set rng = .Range("A2:A" & lastRow)
End With
i = 2
Set com_daily = New Command
Do While Sheet1.Cells(i, 1).Value <> ""
iValue = Sheet1.Cells(i, 4)
With com_daily
.ActiveConnection = con_daily
.CommandText = "update [Sheet11$] set MDU1='" & iValue & "' where Item_ID=" & Sheet1.Cells(i, 3) & ""
.Execute
End With
i = i + 1
Loop
End Sub
Please guide me. it gives me error while execute this above statement
heaps thanks
Last edited: