Bonjour membres du forum !
Très heureux de vous retrouver.
Mon code Insert Into
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 Sub ProgrammerUnSalaire(xIdta As Long, NumSalBase As Long, xMle As Long, xMois As String) Dim NoEnreg As Long Dim vSB As Double Dim vSJ As Variant NoEnreg = F_NumPrgSalaire() vSB = Replace(SalaireBaseEmployé(NumSalBase, xIdta, xMle), ",", ".") vSJ = Replace(Round(vSB / 30, 2), ",", ".") strSql = "INSERT INTO PrgSalaires(Num_Sal,Etabl_Employeur,Num_emp,Mois_prog,Id_NumSalaireBase,Salaire_B,salairej,restapayer) " _ & "VALUES(" & NoEnreg & "," & xIdta & "," & xMle & ",'" & xMois & "'," & NumSalBase & "," & vSB & "," & vSJ & "," & vSB & ")" DoCmd.SetWarnings False DoCmd.RunSQL strSql DoCmd.SetWarnings True End Subregorge des fautes.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 Function SalaireBaseEmployé(NumSalBase As Long, idet As Long, no As Long) As Double On Error GoTo Rama Dim db As Database Dim rst As Recordset Dim sql As String Set db = CurrentDb sql = "select * from SalairesEmploye where Num_SB = " & NumSalBase & " and Ident_Employeur = " & idet & " and Num_Emp = " & no & " order by Date_Maj DESC;" Set rst = db.OpenRecordset(sql) If Not rst.EOF Then rst.MoveFirst SalaireBaseEmployé = rst.Fields("Salaire_base") Else SalaireBaseEmployé = 0 End If Exit Function Rama: MsgBox "Erreur n° " & err.Number & vbCrLf & err.description, vbCritical + vbOKOnly, "Une erreur est survenue" End Function
Voir capture d'erreurs:
Indiquez moi où se trouve les erreurs.
Cordialement.
Partager