Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

Pb code access 2k

1 réponse
Avatar
Guy
Je suis pas super cal=E9 en VB et j'arive pas a trouv=E9=20
l'ereur!!

c'est une migration d'access 2 a access 2k

Y me met une erreur o niveau ce cette ligne
>>>Coeff1 =3D MyRecord.[K_AchatNUMSPA]
"Membre ou methode de donn=E9 introuvable"


Sub MajCoeffComm()
'Permet de mettre =E0 jour la table TA_COEFFCOMM
'=E0 partir des table TA_CoeffAchat et TA_CoeffVente

Dim mabase As Database
Dim SQLQUERY As String
Dim MyRecord As Recordset
Dim Coeff1 As Variant
Dim Coeff2 As Variant

Set mabase =3D CurrentDb
'Set mabase =3D DBEngine.Workspaces(0).Databases(0)

SQLQUERY =3D "SELECT * FROM TA_CoeffAchat;"
Set MyRecord =3D mabase.OpenRecordset(SQLQUERY)
MsgBox " " & MyRecord(1)
If Not MyRecord.EOF Then
Coeff1 =3D MyRecord.[K_AchatNUMSPA]
End If
MyRecord.Close

SQLQUERY =3D "SELECT * FROM TA_CoeffVente;"
Set MyRecord =3D mabase.OpenRecordset(SQLQUERY)
If Not MyRecord.EOF Then
Coeff2 =3D MyRecord.[K_VenteNUMDRIVE]
End If
MyRecord.Close

SQLQUERY =3D "SELECT * FROM TA_CoeffComm;"
Set MyRecord =3D mabase.OpenRecordset(SQLQUERY)
If Not MyRecord.EOF Then
MyRecord.Edit
MyRecord.[K_AchatNUMSPA] =3D Coeff1
MyRecord.[K_VenteNUMDRIVE] =3D Coeff2
MyRecord.Update
End If
MyRecord.Close


mabase.Close

End Sub


Ba merci de toute maniere

+

1 réponse

Avatar
Gafish
Bonjour,

Je suppose que K_AchatNUMSPA est le nom d'un des champs de TA_CoeffAchat
Essaie alors à la place :

Coeff1 = MyRecord.Fields("K_AchatNUMSPA")

Idem pour la suite, tu auras les mêmes erreurs ici :
Coeff2 = MyRecord.[K_VenteNUMDRIVE]
et ici
MyRecord.[K_AchatNUMSPA] = Coeff1
MyRecord.[K_VenteNUMDRIVE] = Coeff2
Même manip à faire

Arnaud

"Guy" a écrit dans le message news:
20b601c4a149$7ebfcc80$
Je suis pas super calé en VB et j'arive pas a trouvé
l'ereur!!

c'est une migration d'access 2 a access 2k

Y me met une erreur o niveau ce cette ligne
Coeff1 = MyRecord.[K_AchatNUMSPA]
"Membre ou methode de donné introuvable"





Sub MajCoeffComm()
'Permet de mettre à jour la table TA_COEFFCOMM
'à partir des table TA_CoeffAchat et TA_CoeffVente

Dim mabase As Database
Dim SQLQUERY As String
Dim MyRecord As Recordset
Dim Coeff1 As Variant
Dim Coeff2 As Variant

Set mabase = CurrentDb
'Set mabase = DBEngine.Workspaces(0).Databases(0)

SQLQUERY = "SELECT * FROM TA_CoeffAchat;"
Set MyRecord = mabase.OpenRecordset(SQLQUERY)
MsgBox " " & MyRecord(1)
If Not MyRecord.EOF Then
Coeff1 = MyRecord.[K_AchatNUMSPA]
End If
MyRecord.Close

SQLQUERY = "SELECT * FROM TA_CoeffVente;"
Set MyRecord = mabase.OpenRecordset(SQLQUERY)
If Not MyRecord.EOF Then
Coeff2 = MyRecord.[K_VenteNUMDRIVE]
End If
MyRecord.Close

SQLQUERY = "SELECT * FROM TA_CoeffComm;"
Set MyRecord = mabase.OpenRecordset(SQLQUERY)
If Not MyRecord.EOF Then
MyRecord.Edit
MyRecord.[K_AchatNUMSPA] = Coeff1
MyRecord.[K_VenteNUMDRIVE] = Coeff2
MyRecord.Update
End If
MyRecord.Close


mabase.Close

End Sub


Ba merci de toute maniere

+