It is giving error 3265 can anyone help
Code:
Private Sub CommandButton1_Click()
Dim cnn As ADODB.Connection 'dim the ADO collection class
Dim rst As ADODB.Recordset 'dim the ADO recordset class
Dim dbPath
Dim x As Long, i As Long
Dim nextrow As Long
Dim table As Range
'Set Data = Range("B39")
Set table = Range("XFD25")
'add error handling
On Error GoTo errHandler:
dbPath = "C:\Darpan\AQF\NewQuoteIB.accdb"
nextrow = Cells(Rows.Count, 1).End(xlUp).Row
Set cnn = New ADODB.Connection
'Check for data
'If Sheet2.Range("A2").Value = "" Then
If ActiveSheet.Range("A2").Value = "" Then
MsgBox " Add the data that you want to send to Database"
Exit Sub
End If
cnn.Open "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & dbPath
Set rst = New ADODB.Recordset 'assign memory to the recordset
'rst.Open Source:="AGS", ActiveConnection:=cnn, _
'rst.Open source:="Euronet", ActiveConnection:=cnn, _'
'
rst.Open source:=Range("R1").Value, ActiveConnection:=cnn, _
CursorType:=adOpenDynamic, LockType:=adLockOptimistic, _
Options:=adCmdTable
'you now have the recordset object
'add the values to it
For x = 2 To nextrow
rst.AddNew
For i = 1 To 10
rst(Cells(1, i).Value) = Cells(x, i).Value
Next i
rst.Update
Next x
'close the recordset
rst.Close
' Close the connection
cnn.Close
'clear memory
Set rst = Nothing
Set cnn = Nothing
'communicate with the user
'MsgBox " The data has been successfully sent to the access database"
'Update the sheet
Application.ScreenUpdating = True
MsgBox "Record submitted successfully"
On Error GoTo 0
Exit Sub
errHandler:
'clear memory
Set rst = Nothing
Set cnn = Nothing
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure Export_Data"
Call closebox
End Sub