Version =20 VersionRequired =20 Begin Form DividingLines = NotDefault AllowDesignChanges = NotDefault DefaultView =0 PictureAlignment =2 DatasheetGridlinesBehavior =3 GridY =10 Width =12703 DatasheetFontHeight =11 ItemSuffix =56 Right =15330 Bottom =12345 DatasheetGridlinesColor =14806254 Filter ="[CodeAgent]='AAA' AND [PeriodeValidite]=1" RecSrcDt = Begin 0x76711b6daf39e440 End RecordSource ="SELECT tbl_Agents.CodeAgent, tbl_Agents.Nom, tbl_Agents.PeriodeValidite, tbl_Age" "nts.Grade, tbl_Agents.Catégorie, tbl_Agents.RémunérationBase, tbl_Agents.Groupe," " tbl_Agents.ResidenceAdmin, tbl_Agents.ResidenceFamiliale, tbl_Agents.Telephone," " tbl_Agents.Matricule, tbl_Agents.TypeVehicule, tbl_Agents.DateAutorisationVP, t" "bl_Agents.PuissanceFiscVP, tbl_Agents.NbKmAutorisesVP, tbl_Agents.TypeVirement F" "ROM tbl_Agents; " OnOpen ="[Event Procedure]" DatasheetFontName ="Calibri" FilterOnLoad =0 ShowPageMargins =0 DisplayOnSharePointSite =1 DatasheetAlternateBackColor =15921906 DatasheetGridlinesColor12 =0 FitToScreen =1 DatasheetBackThemeColorIndex =1 BorderThemeColorIndex =3 ThemeFontIndex =1 ForeThemeColorIndex =0 AlternateBackThemeColorIndex =1 AlternateBackShade =95.0 Begin Begin Label BackStyle =0 FontSize =11 FontName ="Calibri" ThemeFontIndex =1 BackThemeColorIndex =1 BorderThemeColorIndex =0 BorderTint =50.0 ForeThemeColorIndex =0 ForeTint =50.0 GridlineThemeColorIndex =1 GridlineShade =65.0 End Begin CommandButton Width =1701 Height =283 FontSize =11 FontWeight =400 FontName ="Calibri" ForeThemeColorIndex =0 ForeTint =75.0 GridlineThemeColorIndex =1 GridlineShade =65.0 UseTheme =1 Shape =1 Gradient =12 BackThemeColorIndex =4 BackTint =60.0 BorderLineStyle =0 BorderColor =16777215 BorderThemeColorIndex =4 BorderTint =60.0 ThemeFontIndex =1 HoverThemeColorIndex =4 HoverTint =40.0 PressedThemeColorIndex =4 PressedShade =75.0 HoverForeThemeColorIndex =0 HoverForeTint =75.0 PressedForeThemeColorIndex =0 PressedForeTint =75.0 End Begin TextBox AddColon = NotDefault FELineBreak = NotDefault BorderLineStyle =0 Width =1701 LabelX =-1701 FontSize =11 FontName ="Calibri" AsianLineBreak =1 BackThemeColorIndex =1 BorderThemeColorIndex =1 BorderShade =65.0 ThemeFontIndex =1 ForeThemeColorIndex =0 ForeTint =75.0 GridlineThemeColorIndex =1 GridlineShade =65.0 End Begin ListBox BorderLineStyle =0 Width =1701 Height =1417 LabelX =-1701 FontSize =11 FontName ="Calibri" AllowValueListEdits =1 InheritValueList =1 ThemeFontIndex =1 BackThemeColorIndex =1 BorderThemeColorIndex =1 BorderShade =65.0 ForeThemeColorIndex =0 ForeTint =75.0 GridlineThemeColorIndex =1 GridlineShade =65.0 End Begin ComboBox AddColon = NotDefault BorderLineStyle =0 Width =1701 LabelX =-1701 FontSize =11 FontName ="Calibri" AllowValueListEdits =1 InheritValueList =1 ThemeFontIndex =1 BackThemeColorIndex =1 BorderThemeColorIndex =1 BorderShade =65.0 ForeThemeColorIndex =2 ForeShade =50.0 GridlineThemeColorIndex =1 GridlineShade =65.0 End Begin FormHeader Height =510 BackColor =15849926 Name ="EntêteFormulaire" AlternateBackThemeColorIndex =1 AlternateBackShade =95.0 BackThemeColorIndex =2 BackTint =20.0 Begin Begin Label OverlapFlags =85 Left =170 Top =56 Width =3986 Height =334 FontSize =13 BorderColor =8355711 Name ="Étiquette20" Caption ="Création d'un nouvel agent" GridlineColor =10921638 LayoutCachedLeft =170 LayoutCachedTop =56 LayoutCachedWidth =4156 LayoutCachedHeight =390 ForeTint =100.0 End End End Begin Section Height =8787 BackColor =14270637 Name ="Détail" AlternateBackColor =15921906 AlternateBackThemeColorIndex =1 AlternateBackShade =95.0 Begin Begin TextBox OverlapFlags =85 IMESentenceMode =3 Left =917 Top =1530 Width =3066 Height =315 ColumnWidth =3225 BorderColor =10921638 ForeColor =4210752 Name ="Nom" ControlSource ="Nom" GridlineColor =10921638 LayoutCachedLeft =917 LayoutCachedTop =1530 LayoutCachedWidth =3983 LayoutCachedHeight =1845 Begin Begin Label OverlapFlags =85 Left =175 Top =1530 Width =585 Height =315 BorderColor =8355711 Name ="Étiquette1" Caption ="Nom:" GridlineColor =10921638 LayoutCachedLeft =175 LayoutCachedTop =1530 LayoutCachedWidth =760 LayoutCachedHeight =1845 ForeTint =100.0 End End End Begin TextBox OverlapFlags =85 IMESentenceMode =3 Left =2561 Top =2040 Width =1431 Height =315 TabIndex =1 BorderColor =10921638 ForeColor =4210752 Name ="Grade" ControlSource ="Grade" GridlineColor =10921638 LayoutCachedLeft =2561 LayoutCachedTop =2040 LayoutCachedWidth =3992 LayoutCachedHeight =2355 Begin Begin Label OverlapFlags =85 Left =180 Top =2040 Width =890 Height =315 BorderColor =8355711 Name ="Étiquette2" Caption ="Grade:" GridlineColor =10921638 LayoutCachedLeft =180 LayoutCachedTop =2040 LayoutCachedWidth =1070 LayoutCachedHeight =2355 ForeTint =100.0 End End End Begin TextBox OverlapFlags =85 IMESentenceMode =3 Left =2561 Top =2437 Width =1431 Height =315 TabIndex =2 BorderColor =10921638 ForeColor =4210752 Name ="Catégorie" ControlSource ="Catégorie" GridlineColor =10921638 LayoutCachedLeft =2561 LayoutCachedTop =2437 LayoutCachedWidth =3992 LayoutCachedHeight =2752 Begin Begin Label OverlapFlags =85 Left =180 Top =2437 Width =1080 Height =315 BorderColor =8355711 Name ="Étiquette3" Caption ="Catégorie:" GridlineColor =10921638 LayoutCachedLeft =180 LayoutCachedTop =2437 LayoutCachedWidth =1260 LayoutCachedHeight =2752 ForeTint =100.0 End End End Begin TextBox OverlapFlags =85 IMESentenceMode =3 Left =2561 Top =2834 Width =1431 Height =315 TabIndex =3 BorderColor =10921638 ForeColor =4210752 Name ="RémunérationBase" ControlSource ="RémunérationBase" GridlineColor =10921638 LayoutCachedLeft =2561 LayoutCachedTop =2834 LayoutCachedWidth =3992 LayoutCachedHeight =3149 Begin Begin Label OverlapFlags =85 Left =180 Top =2834 Width =2310 Height =315 BorderColor =8355711 Name ="Étiquette4" Caption ="Rémunération de base:" GridlineColor =10921638 LayoutCachedLeft =180 LayoutCachedTop =2834 LayoutCachedWidth =2490 LayoutCachedHeight =3149 ForeTint =100.0 End End End Begin TextBox OverlapFlags =85 IMESentenceMode =3 Left =2578 Top =3231 Width =1401 Height =315 TabIndex =4 BorderColor =10921638 ForeColor =4210752 Name ="Groupe" ControlSource ="Groupe" GridlineColor =10921638 LayoutCachedLeft =2578 LayoutCachedTop =3231 LayoutCachedWidth =3979 LayoutCachedHeight =3546 Begin Begin Label OverlapFlags =85 Left =180 Top =3231 Width =795 Height =315 BorderColor =8355711 Name ="Étiquette5" Caption ="Groupe" GridlineColor =10921638 LayoutCachedLeft =180 LayoutCachedTop =3231 LayoutCachedWidth =975 LayoutCachedHeight =3546 ForeTint =100.0 End End End Begin TextBox OverlapFlags =85 IMESentenceMode =3 Left =7606 Top =1530 Width =4191 Height =750 TabIndex =5 BorderColor =10921638 ForeColor =4210752 Name ="ResidenceAdmin" ControlSource ="ResidenceAdmin" GridlineColor =10921638 LayoutCachedLeft =7606 LayoutCachedTop =1530 LayoutCachedWidth =11797 LayoutCachedHeight =2280 Begin Begin Label OverlapFlags =85 Left =5005 Top =1530 Width =2490 Height =315 BorderColor =8355711 Name ="Étiquette6" Caption ="Résidence administrative:" GridlineColor =10921638 LayoutCachedLeft =5005 LayoutCachedTop =1530 LayoutCachedWidth =7495 LayoutCachedHeight =1845 ForeTint =100.0 End End End Begin TextBox OverlapFlags =85 IMESentenceMode =3 Left =7606 Top =2380 Width =4191 Height =780 TabIndex =6 BorderColor =10921638 ForeColor =4210752 Name ="ResidenceFamiliale" ControlSource ="ResidenceFamiliale" GridlineColor =10921638 LayoutCachedLeft =7606 LayoutCachedTop =2380 LayoutCachedWidth =11797 LayoutCachedHeight =3160 Begin Begin Label OverlapFlags =85 Left =4998 Top =2380 Width =2040 Height =315 BorderColor =8355711 Name ="Étiquette7" Caption ="Résidence familiale:" GridlineColor =10921638 LayoutCachedLeft =4998 LayoutCachedTop =2380 LayoutCachedWidth =7038 LayoutCachedHeight =2695 ForeTint =100.0 End End End Begin TextBox OverlapFlags =85 IMESentenceMode =3 Left =7606 Top =3344 Width =3411 Height =315 TabIndex =7 BorderColor =10921638 ForeColor =4210752 Name ="Telephone" ControlSource ="Telephone" GridlineColor =10921638 LayoutCachedLeft =7606 LayoutCachedTop =3344 LayoutCachedWidth =11017 LayoutCachedHeight =3659 Begin Begin Label OverlapFlags =85 Left =5005 Top =3340 Width =1140 Height =315 BorderColor =8355711 Name ="Étiquette9" Caption ="Téléphone:" GridlineColor =10921638 LayoutCachedLeft =5005 LayoutCachedTop =3340 LayoutCachedWidth =6145 LayoutCachedHeight =3655 ForeTint =100.0 End End End Begin TextBox OverlapFlags =85 IMESentenceMode =3 Left =2560 Top =3627 Width =1431 Height =315 TabIndex =8 BorderColor =10921638 ForeColor =4210752 Name ="Matricule" ControlSource ="Matricule" GridlineColor =10921638 LayoutCachedLeft =2560 LayoutCachedTop =3627 LayoutCachedWidth =3991 LayoutCachedHeight =3942 Begin Begin Label OverlapFlags =85 Left =180 Top =3628 Width =960 Height =315 BorderColor =8355711 Name ="Étiquette10" Caption ="Matricule" GridlineColor =10921638 LayoutCachedLeft =180 LayoutCachedTop =3628 LayoutCachedWidth =1140 LayoutCachedHeight =3943 ForeTint =100.0 End End End Begin TextBox OverlapFlags =85 IMESentenceMode =3 Left =3984 Top =5102 Width =1641 Height =315 TabIndex =9 BorderColor =10921638 ForeColor =4210752 Name ="DateAutorisationVP" ControlSource ="DateAutorisationVP" StatusBarText ="Date de l'autorisation d'utiliser le véhicule personnel" GridlineColor =10921638 LayoutCachedLeft =3984 LayoutCachedTop =5102 LayoutCachedWidth =5625 LayoutCachedHeight =5417 Begin Begin Label OverlapFlags =85 Left =180 Top =5101 Width =3630 Height =315 BorderColor =8355711 Name ="Étiquette12" Caption ="Date de l'autorisation de circuler:" GridlineColor =10921638 LayoutCachedLeft =180 LayoutCachedTop =5101 LayoutCachedWidth =3810 LayoutCachedHeight =5416 ForeTint =100.0 End End End Begin TextBox OverlapFlags =85 IMESentenceMode =3 Left =3978 Top =5499 Width =1641 Height =315 ColumnWidth =2640 TabIndex =10 BorderColor =10921638 ForeColor =4210752 Name ="PuissanceFiscVP" ControlSource ="PuissanceFiscVP" StatusBarText ="Puissance Fiscale Réelle du VP" GridlineColor =10921638 LayoutCachedLeft =3978 LayoutCachedTop =5499 LayoutCachedWidth =5619 LayoutCachedHeight =5814 Begin Begin Label OverlapFlags =85 Left =175 Top =5500 Width =2430 Height =315 BorderColor =8355711 Name ="Étiquette13" Caption ="Puissance fiscale (en CV):" GridlineColor =10921638 LayoutCachedLeft =175 LayoutCachedTop =5500 LayoutCachedWidth =2605 LayoutCachedHeight =5815 ForeTint =100.0 End End End Begin TextBox OverlapFlags =85 IMESentenceMode =3 Left =3978 Top =5895 Width =1641 Height =315 TabIndex =11 BorderColor =10921638 ForeColor =4210752 Name ="NbKmAutorisesVP" ControlSource ="NbKmAutorisesVP" StatusBarText ="Nombre de Km que l'agent est autorisé à parcourir avec son VP" GridlineColor =10921638 LayoutCachedLeft =3978 LayoutCachedTop =5895 LayoutCachedWidth =5619 LayoutCachedHeight =6210 Begin Begin Label OverlapFlags =85 Left =175 Top =5890 Width =2310 Height =315 BorderColor =8355711 Name ="Étiquette14" Caption ="Nombr de Km autorisés:" GridlineColor =10921638 LayoutCachedLeft =175 LayoutCachedTop =5890 LayoutCachedWidth =2485 LayoutCachedHeight =6205 ForeTint =100.0 End End End Begin TextBox OverlapFlags =85 IMESentenceMode =3 Left =7606 Top =3798 Width =3411 Height =315 TabIndex =13 BorderColor =10921638 ForeColor =4210752 Name ="TypeVirement" ControlSource ="TypeVirement" GridlineColor =10921638 LayoutCachedLeft =7606 LayoutCachedTop =3798 LayoutCachedWidth =11017 LayoutCachedHeight =4113 Begin Begin Label OverlapFlags =85 Left =5005 Top =3805 Width =1770 Height =315 BorderColor =8355711 Name ="Étiquette15" Caption ="Type de virement:" GridlineColor =10921638 LayoutCachedLeft =5005 LayoutCachedTop =3805 LayoutCachedWidth =6775 LayoutCachedHeight =4120 ForeTint =100.0 End End End Begin ComboBox OverlapFlags =85 IMESentenceMode =3 ColumnCount =2 Left =2334 Top =4648 Width =3288 Height =315 TabIndex =14 BorderColor =10921638 ForeColor =4138256 ColumnInfo ="\"\";\"\";\"\";\"\";\"10\";\"510\"" Name ="TypeVehicule" ControlSource ="TypeVehicule" RowSourceType ="Table/Query" RowSource ="SELECT tbl_Listes.CodeChoix, tbl_Listes.LibelleChoix, tbl_Listes.TableListe, tbl" "_Listes.ChampListe FROM tbl_Listes WHERE (((tbl_Listes.TableListe)='tbl_Agents')" " AND ((tbl_Listes.ChampListe)='TypeVehicule')); " ColumnWidths ="0;2835" GridlineColor =10921638 LayoutCachedLeft =2334 LayoutCachedTop =4648 LayoutCachedWidth =5622 LayoutCachedHeight =4963 Begin Begin Label OverlapFlags =85 Left =180 Top =4648 Width =1710 Height =315 BorderColor =8355711 Name ="Étiquette22" Caption ="Type de véhicule:" GridlineColor =10921638 LayoutCachedLeft =180 LayoutCachedTop =4648 LayoutCachedWidth =1890 LayoutCachedHeight =4963 ForeTint =100.0 End End End Begin Label FontUnderline = NotDefault OverlapFlags =85 Left =180 Top =1133 Width =789 Height =340 FontSize =12 FontWeight =700 BorderColor =8355711 Name ="Étiquette23" Caption ="Poste:" GridlineColor =10921638 LayoutCachedLeft =180 LayoutCachedTop =1133 LayoutCachedWidth =969 LayoutCachedHeight =1473 ForeTint =100.0 End Begin Label FontUnderline = NotDefault OverlapFlags =85 Left =5005 Top =1135 Width =1485 Height =345 FontSize =12 FontWeight =700 BorderColor =8355711 Name ="Étiquette24" Caption ="Coordonnées:" GridlineColor =10921638 LayoutCachedLeft =5005 LayoutCachedTop =1135 LayoutCachedWidth =6490 LayoutCachedHeight =1480 ForeTint =100.0 End Begin TextBox OverlapFlags =85 IMESentenceMode =3 Left =4308 Top =510 Width =1819 Height =300 ColumnOrder =3 FontWeight =700 TabIndex =12 BorderColor =10921638 Name ="NvelleDate" Format ="Short Date" GridlineColor =10921638 LayoutCachedLeft =4308 LayoutCachedTop =510 LayoutCachedWidth =6127 LayoutCachedHeight =810 ForeTint =100.0 End Begin Label FontUnderline = NotDefault OverlapFlags =85 Left =180 Top =4195 Width =2085 Height =345 FontSize =12 FontWeight =700 BorderColor =8355711 Name ="Étiquette25" Caption ="Véhicule personnel:" GridlineColor =10921638 LayoutCachedLeft =180 LayoutCachedTop =4195 LayoutCachedWidth =2265 LayoutCachedHeight =4540 ForeTint =100.0 End Begin Label FontUnderline = NotDefault OverlapFlags =85 Left =165 Top =510 Width =4035 Height =345 FontSize =12 FontWeight =700 BorderColor =8355711 Name ="Étiquette47" Caption ="Ces données seront valides à partir du:" GridlineColor =10921638 LayoutCachedLeft =165 LayoutCachedTop =510 LayoutCachedWidth =4200 LayoutCachedHeight =855 ForeTint =100.0 End Begin TextBox OverlapFlags =85 IMESentenceMode =3 Left =2097 Top =113 Width =1086 Height =315 FontWeight =700 TabIndex =15 BorderColor =10921638 Name ="CodeAgent" ControlSource ="CodeAgent" GridlineColor =10921638 LayoutCachedLeft =2097 LayoutCachedTop =113 LayoutCachedWidth =3183 LayoutCachedHeight =428 ForeTint =100.0 Begin Begin Label FontUnderline = NotDefault OverlapFlags =85 Left =165 Top =120 Width =1815 Height =315 FontSize =12 FontWeight =700 BorderColor =8355711 Name ="Étiquette0" Caption ="Code de l'agent:" GridlineColor =10921638 LayoutCachedLeft =165 LayoutCachedTop =120 LayoutCachedWidth =1980 LayoutCachedHeight =435 ForeTint =100.0 End End End Begin Label OverlapFlags =93 Left =170 Top =6836 Width =7365 Height =585 BorderColor =8355711 Name ="Étiquette50" Caption ="Si l'agent a déja parcouru des kilomètres avec son véhicule personnel lors de la" " création, veuillez en saisir la quantité ici:" GridlineColor =10921638 LayoutCachedLeft =170 LayoutCachedTop =6836 LayoutCachedWidth =7535 LayoutCachedHeight =7421 ForeTint =100.0 End Begin TextBox OverlapFlags =223 IMESentenceMode =3 Left =3973 Top =7086 Width =1294 Height =315 TabIndex =16 BorderColor =10921638 ForeColor =4210752 Name ="KmSuppl" DefaultValue ="0" GridlineColor =10921638 ShowDatePicker =0 LayoutCachedLeft =3973 LayoutCachedTop =7086 LayoutCachedWidth =5267 LayoutCachedHeight =7401 End Begin Label FontUnderline = NotDefault OverlapFlags =85 Left =170 Top =6387 Width =2250 Height =345 FontSize =12 FontWeight =700 BorderColor =8355711 Name ="Étiquette52" Caption ="Kilomètres initiaux:" GridlineColor =10921638 LayoutCachedLeft =170 LayoutCachedTop =6387 LayoutCachedWidth =2420 LayoutCachedHeight =6732 ForeTint =100.0 End Begin TextBox OverlapFlags =85 IMESentenceMode =3 Left =231 Top =7879 Width =5222 Height =585 TabIndex =17 BorderColor =10921638 ForeColor =4210752 Name ="MotifKmSuppl" GridlineColor =10921638 LayoutCachedLeft =231 LayoutCachedTop =7879 LayoutCachedWidth =5453 LayoutCachedHeight =8464 Begin Begin Label OverlapFlags =85 Left =175 Top =7541 Width =5490 Height =315 BorderColor =8355711 Name ="Étiquette54" Caption ="(Optionnel)Raison d'être des kilomètres supplémentaires:" GridlineColor =10921638 LayoutCachedLeft =175 LayoutCachedTop =7541 LayoutCachedWidth =5665 LayoutCachedHeight =7856 ForeTint =100.0 End End End Begin Label OverlapFlags =215 Left =5272 Top =7086 Width =510 Height =284 BorderColor =8355711 Name ="Étiquette55" Caption ="Km" GridlineColor =10921638 LayoutCachedLeft =5272 LayoutCachedTop =7086 LayoutCachedWidth =5782 LayoutCachedHeight =7370 ForeTint =100.0 End End End Begin FormFooter Height =623 BackColor =14270637 Name ="PiedFormulaire" AlternateBackThemeColorIndex =1 AlternateBackShade =95.0 Begin Begin CommandButton OverlapFlags =85 Left =7993 Top =113 Width =1647 Height =403 ForeColor =4210752 Name ="CmdOK" Caption ="Créer" OnClick ="[Event Procedure]" GridlineColor =10921638 LayoutCachedLeft =7993 LayoutCachedTop =113 LayoutCachedWidth =9640 LayoutCachedHeight =516 Gradient =0 BackColor =15921906 BackThemeColorIndex =1 BackTint =100.0 BackShade =95.0 BorderColor =14136213 HoverColor =15060409 PressedColor =9592887 HoverForeColor =4210752 PressedForeColor =4210752 WebImagePaddingLeft =2 WebImagePaddingTop =2 WebImagePaddingRight =1 WebImagePaddingBottom =1 End Begin CommandButton OverlapFlags =85 Left =9977 Top =113 Width =1647 Height =403 TabIndex =1 ForeColor =4210752 Name ="Annuler" Caption ="Annuler" OnClick ="[Event Procedure]" GridlineColor =10921638 LayoutCachedLeft =9977 LayoutCachedTop =113 LayoutCachedWidth =11624 LayoutCachedHeight =516 Gradient =0 BackColor =15921906 BackThemeColorIndex =1 BackTint =100.0 BackShade =95.0 BorderColor =14136213 HoverColor =15060409 PressedColor =9592887 HoverForeColor =4210752 PressedForeColor =4210752 WebImagePaddingLeft =2 WebImagePaddingTop =2 WebImagePaddingRight =1 WebImagePaddingBottom =1 End End End End End CodeBehindForm Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = True Attribute VB_PredeclaredId = True Attribute VB_Exposed = False Option Compare Database Private Sub Annuler_Click() Dim avertissement As Integer Dim sql, CodeAgent As String If MsgBox("Attention, les données saisies seront perdues. Voulez-vous continuer?", vbYesNo) = vbNo Then Exit Sub CodeAgent = Me.CodeAgent If DCount("JourRH", "tbl_formDep", "[CodeAgent]='" & CodeAgent & "'") > 0 Or DCount("JourRH", "tbl_formHS", "[CodeAgent]='" & CodeAgent & "'") > 0 Then MsgBox "Des données RH ont été importées pour cet agent, l'opération de suppression est annulée" Exit Sub End If avertissement = Nz(parametre("AvertSQL"), 1) If avertissement = 0 Then DoCmd.SetWarnings False sql = "DELETE * FROM tbl_Agents WHERE [CodeAgent]='" & CodeAgent & "';" DoCmd.RunSQL sql sql = "DELETE * FROM tbl_PeriodeAgent WHERE [CodeAgent]='" & CodeAgent & "';" DoCmd.RunSQL sql sql = "DELETE * FROM tbl_KmSuppl WHERE [CodeAgent]='" & CodeAgent & "';" DoCmd.RunSQL sql DoCmd.SetWarnings True DoCmd.Close End Sub Private Sub Form_Open(Cancel As Integer) Dim rs As DAO.Recordset Dim CodeAgent As String 'l'ajout d'un nouvel agent implique l'ajout d'une ligne à la table agent, ainsi que d'une ligne à la table tbl_PeriodeAgent. 'La création de cette ligne implique de connaitre la date à partir de laquelle ce nouvel agent est opérationnel 'si cette date n'est pas en janvier, une ligne doit être ajoutée aux tables tbl_FormDep et tbl_FormHS qui servira de conditions initiales Me.NvelleDate = "01/" & Format(Month(Now()), "00") & "/" & Year(Now()) CodeAgent = Nz(InputBox("Veuillez saisir le code de l'agent à ajouter:"), "") If CodeAgent = "" Then MsgBox "Opération Annulée" DoCmd.Close Exit Sub End If 'Création d'une nouvelle ligne dans tbl_Agents Set rs = CurrentDb.OpenRecordset("tbl_Agents") rs.AddNew rs![CodeAgent] = CodeAgent rs![PeriodeValidite] = 1 rs.Update 'on place l'enregistrement du formulaire sur ce nouvel enregistrement Me.FilterOn = False Me.Filter = "[CodeAgent]='" & CodeAgent & "' AND [PeriodeValidite]=1" Me.FilterOn = True Me.Refresh End Sub Private Sub CmdOK_Click() Dim rs As DAO.Recordset Dim NvelleDate As Date Dim CodeAgent As String CodeAgent = Me.CodeAgent NvelleDate = CDate(Me.NvelleDate) If IsNull(NvelleDate) Then Me.NvelleDate.BackColor = 12566463 Exit Sub End If NvPeriode = NvellePeriode("tbl_PeriodeAgent", CodeAgent, NvelleDate) If NvPeriode = 0 Then MsgBox "Erreur lors de la création de la nouvelle période de validité." Exit Sub End If If Nz(Me.KmSuppl, 0) <> 0 Then Set rs = CurrentDb.OpenRecordset("tbl_KmSuppl") rs.AddNew rs![CodeAgent] = CodeAgent rs![anneeRH] = Year(NvelleDate) rs![KmSuppl] = Me.KmSuppl rs![Motif] = Nz(Me.MotifKmSuppl, "") rs.Update End If Call CreerMsg(13, , CodeAgent) MsgBox "L'agent " & CodeAgent & " a été créé." DoCmd.Close End Sub