ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Excel and AS400 DB2 database (https://www.excelbanter.com/excel-programming/319700-excel-as400-db2-database.html)

Esperanza[_2_]

Excel and AS400 DB2 database
 
Hy Excel Experts !

I need to export data from excel to AS400 DB2 file database.
I have full right on the library file.

I always got the following error message:

"3251 Current Recordset does not support updating. This may be a limitation
of the provider, or the selected locktype"


Thanks for your help!!
Experanza




'================================================= ===
Voici le code :
Dim rsTables As Recordset
Dim strSelect, strPassWord400
Set conn = New ADODB.Connection
Dim nbrRecords, NoLigne, index As Integer


strPassWord400 = InputBox("Veullez entrez votre mot de passe 400")

conn.Open "Provider=IBMDA400;Password=" & strPassWord400 & ";User
ID=COCO;Data Source=tttt.cccc.qc.ca;Transport Product=Client
Access;SSL=DEFAULT"


Set rsTables = New ADODB.Recordset

On Error GoTo Exportation_ERR

rsTables.Open "COCO.FILE", conn, adOpenKeyset, adLockOptimistic,
adCmdTable

'================================================= =================
'TEST D'ECRITURE DANS LE FICHIER 400
'================================================= ================


For NoLigne = 2 To 10

rsTables.AddNew
rsTables!EMPNUM = ActiveSheet.Range("A" + CStr(NoLigne))
rsTables!LUN = ActiveSheet.Range("B" + CStr(NoLigne))
rsTables!MAR = ActiveSheet.Range("C" + CStr(NoLigne))
rsTables!MER = ActiveSheet.Range("D" + CStr(NoLigne))
rsTables.Update
Next

Exit Sub

Exportation_ERR:
MsgBox (Err.Number & " " & Err.Description)

End Sub






All times are GMT +1. The time now is 08:36 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com