Thanks bnix
Here is the full code but this time Im using an INSERT INTO satement
Public wksSpace As Workspace, cnxMyOracleDB As Connection,rstTemp As Recordset
Public cnxMyOracleDBConnected As Boolean ' True when MyOracleDB connection is established, false otherwise
Set rstTemp = cnxMyOracleDB.OpenRecordset(sRequest, dbOpenSnapshot)
rstTemp.Close
p = p + 1
If i = "43" Then
Exit Sub
End If
Exit Sub
Sub WritetoMyOracleDB() '--- Write data (x) into "MEASURES_D" table of MyOracleDB.
On Error GoTo error_writing
If Not cnxMyOracleDBConnected Then
''Initialise Connection to Oracle Database
'[-------------------------------------------------------------------
On Error GoTo errcode
If Not cnxMyOracleDBConnected Then
Set wksSpace = CreateWorkspace("ODBC space", "user", "", dbUseODBC)
wksSpace.DefaultCursorDriver = dbUseODBCCursor
Set cnxMyOracleDB = wksSpace.OpenConnection("ODBC Connection", , , "ODBC;DSN=DSN_MyOracleDB;UID=calc;PWD=calc;LOGINTIMEOUT=0;")
cnxMyOracleDBConnected = True
Call MsgBox("Youve been connected to MyOracleDB Database, ", vbOKOnly, "Connected..")
End If
Exit Sub
errcode:
Call MsgBox("There was an error connection with MyOracleDB Database, " & _
"please inform your Database administrator." _
, vbOKOnly, "Error in connection")
End
'[-------------------------------------------------------------------
End If
'[--------------------------------------------------------------------
Dim CurrentEntity_id
Dim CurrentPeriod_id
Dim CurrentProduct_id
Dim CurrentIndicator_id
Dim CurrentEntry_type_id
Dim CurrentUnit_id
Dim Measure_Date
Dim Measure_id
Dim realised_value
Dim adjusted_value1
Dim adjusted_value2
Dim adjusted_value3
Dim relevant_value
Dim comment_m
Dim modif_date
Dim modif_program
CurrentEntity_id = Range("MyIndic").Offset(0, 1)
CurrentPeriod_id = Range("MyIndic").Offset(0, 2)
CurrentProduct_id = Range("MyIndic").Offset(0, 3)
CurrentIndicator_id = Range("MyIndic").Offset(0, 4)
CurrentEntry_type_id = Range("MyIndic").Offset(0, 5)
CurrentUnit_id = Range("MyIndic").Offset(0, 6)
Measure_Date = Range("MyIndic").Offset(0, 7)
Measure_id = Range("MyIndic").Offset(0, 
realised_value = Range("MyIndic").Offset(0, 9)
adjusted_value1 = Range("MyIndic").Offset(0, 10)
adjusted_value2 = Range("MyIndic").Offset(0, 11)
adjusted_value3 = Range("MyIndic").Offset(0, 12)
relevant_value = Range("MyIndic").Offset(0, 13)
comment_m = Range("MyIndic").Offset(0, 14)
modif_date = "SYSDATE"
modif_program = Range("MyIndic").Offset(0, 16)
']----------------------------------------------------------------------------
WritingIntoMyOracleDB = True
sRequest = "INSERT INTO MEASURES_D VALUES" & _
"(" & _
CurrentEntity_id & "," & _
CurrentPeriod_id & "," & _
CurrentProduct_id & "," & _
CurrentIndicator_id & "," & _
CurrentEntry_type_id & "," & _
CurrentUnit_id & "," & _
"TO_DATE('" & Measure_Date & "','DD/MM/YYYY')," & _
Measure_id & "," & _
realised_value & "," & _
adjusted_value1 & "," & _
adjusted_value2 & "," & _
adjusted_value3 & ",'" & _
relevant_value & "'," & _
comment_m & "," & _
modif_date & ",'" & _
modif_program & _
"')"
Set rstTemp = cnxMyOracleDB.OpenRecordset(sRequest, dbOpenSnapshot)
rstTemp.Close
error_writing:
MsgBox Error
End Sub
This could not work
'cnxMyOracleDB.Execute StrSql, , adExecuteNoRecords