Prble vba sous accesse ,aide urgente svp

Résolu/Fermé
didi debutante - 24 juin 2008 à 08:17
 didi debutante - 24 juin 2008 à 09:09
Bonjour,
j'ai un gros pble ,j'arrive pas a faire tourner ce code ,c un vrai pble,est ce que qq peut m'aider .merci
voila le code:

Option Compare Database


Sub TestMAJ2()
Dim wrk As Workspace
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim SQL As String
Dim SQL_S, SQL_U, SQL_I As String
Set wrk = DBEngine.Workspaces(0)
Set db = DBEngine.OpenDatabase("D:\SAFIG\SAFIG.mdb")
SQL = "SELECT * FROM Import ;"
Set rs = db.OpenRecordset(SQL, dbOpenForwardOnly, dbReadOnly)
Do While Not rs.EOF

MsgBox (rs("Clé"))

SQL_S = "SELECT Clé FROM SAFIG where Clé =" & rs("Clé") & ";"
Set conn = CurrentProject.Connection
conn.Execute SQL

If Not (rs.EOF Or rs.BOF) Then

'Si clé trouvée, Requête pour UPDATE dans SAFIG
SQL_U = "UPDATE SAFIG " & _
"SET IDREMISE = " & rs("Idremise") & "," & _
" perimetre = " & rs("perimetre") & "," & _
" DateRemise2 = " & rs("DateRemise2") & "," & _
" Vacation = " & rs("Vacation") & "," & _
" FileInteg = " & rs("FilInteg") & "," & _
" FileCloture = " & rs("FileCloture") & "," & _
" Restitution = " & rs("Restitution") & "," & _
" MotifRejet = " & rs("MotifRejet") & "," & _
" DestRejet = " & rs("DestRejet") & "," & _
" Adresse1 = " & rs("Adresse1") & "," & _
" Adresse2 = " & rs("Adresse2") & "," & _
" Adresse3 = " & rs("Adresse3") & "," & _
" Adresse4 = " & rs("Adresse4") & "," & _
" Centre = " & rs("Centre") & "," & _
" Origine = " & rs("Origine") & "," & _
" RefAXA = " & rs("RefAXA") & "," & _
" URL = " & rs("URL") & "," & _
" Lignes = " & rs("Lignes") & "," & _
" Pages = " & rs("Pages") & "," & _
" EnCours = " & rs("EnCours") & "WHERE Clé = " & rs("Clé") & ";"
MsgBox ("update" & SQL_U)
Else
'Requête pour insertion dans SAFIG

SQL_I = "INSERT INTO SAFIG SELECT Import.* FROM Import WHERE Clé=" & rs("Clé") & ";"

MsgBox ("insert" & SQL_I)
End If
rs.MoveNext
Loop


End Sub

2 réponses

didi debutante
24 juin 2008 à 08:59
il y a personne qui sais please
0
didi debutante
24 juin 2008 à 09:09
please
0