1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109
| Private Sub Commande44_Click()
'Remettre à Blanc
NART = ""
NDES = ""
NUQ = ""
NTYP = ""
NEMPL = ""
End Sub
Private Sub AFFC1_change()
Me.CART1 = Me.AFFC1.Column(1)
End Sub
Private Sub IMPORTATION_Click()
Dim sFichierChoisi As String
sFichierChoisi = OuvrirUnFichier(Me.Hwnd, "Sélection du fichier à importer", 1, "Fichier Excel", "xls")
On Error GoTo Line1 ' cas où une cause inconnue interrompt le processus; par exemple, choix d'un fichier pas importable
If (InStr(sFichierChoisi, "xls") = 0) Then 'cas ou aucun fichier n'a été choisi
GoTo Line2
End If
DoCmd.SetWarnings True
DoCmd.TransferSpreadsheet acImport, 10, "MAG", sFichierChoisi, True
DoCmd.Beep
MsgBox "Importation Finished", vbInformation, "Importation"
Line1:
MsgBox "Le processus a été interrompu pour une cause inconnue. Aucun fichier n'a pu être importé"
Line2:
MsgBox "Vous n'avez pas choisi de fichier à importer. Le processus a donc été interrompu."
End Sub
Private Sub CREATION_AJOUT_Click()
'DoCmd.SetWarnings False
'vérifier que les champs sont pas nuls
If IsNull(Me.NART) Then
MsgBox ("Le code doit être indiqué")
Exit Sub
End If
If IsNull(Me.NDES) Then
MsgBox ("La désignation doit être indiquée")
Exit Sub
End If
If IsNull(Me.NUQ) Then
MsgBox ("La désignation doit être indiquée")
Exit Sub
End If
If IsNull(Me.NTYP) Then
MsgBox ("Le type doit être indiqué")
Exit Sub
End If
If IsNull(Me.NEMPL) Then
MsgBox ("L'emplacement doit être indiqué")
Exit Sub
End If
DoCmd.OpenQuery "CREATION_CODE"
End Sub
Private Sub Entrée_Click()
Me.VUE = Me.recherche
Me.DES10 = DLookup("Designation", "MAG", "[Code_produit]= '" & Forms![PREPARATION PVI]![VUE] & "'")
'Sauvegarder les données recherchées dans la table nomenclature
DoCmd.OpenQuery "Ajout_table_nomenclature"
'Réaffichage du sous-formulaire => met à jour l'affichage
Me![NOMEMCLATURE].Form.RecordSource = Me![NOMEMCLATURE].Form.RecordSource
End Sub
Private Sub Form_Open(Cancel As Integer)
VALIDER_Click
End Sub
Private Sub RAZ_Click()
DoCmd.OpenQuery "RAZ_table_Nomenclature"
'Réaffichage du sous-formulaire => met à jour l'affichage
Me![NOMEMCLATURE].Form.RecordSource = Me![NOMEMCLATURE].Form.RecordSource
End Sub
Private Sub Recherche_AfterUpdate()
Me.VUE = Me.recherche
Me.DES10 = DLookup("Designation", "MAG", "[Code_produit]= '" & Forms![PREPARATION PVI]![VUE] & "'")
'Sauvegarder les données recherchées dans la table nomenclature
DoCmd.OpenQuery "Ajout_table_nomenclature"
'Réaffichage du sous-formulaire => met à jour l'affichage
Me![NOMEMCLATURE].Form.RecordSource = Me![NOMEMCLATURE].Form.RecordSource
End Sub
Private Sub TypeMag_BeforeUpdate(Cancel As Integer)
Me.Code_produit = Me.TypeMag
Me.Designation = DLookup("Designation", "MAG", "Code_produit='" & Me.[Code_produit] & "'")
'Me.Designation = DLookup("DESIGNATION", "MAG27JAN2011", "ARTICLE='" & Me.[ARTICLE] & "'")
'Me.EMPLACEMENT = DLookup("emplacement", "MAG27JAN2011", "ARTICLE='" & Me.[ARTICLE] & "'")
'Me.MAG = DLookup("MAG", "MAG27JAN2011", "ARTICLE='" & Me.[ARTICLE] & "'")
'Me.UQ = DLookup("UQ", "MAG27JAN2011", "ARTICLE='" & Me.[ARTICLE] & "'")
Me![NOMEMCLATURE].Form.RecordSource = Me![NOMEMCLATURE].Form.RecordSource
End Sub
'Private Sub TypeMag_AfterUpdate()
'VALIDER_Click
'End Sub
Private Sub VALIDER_Click()
Me![NOMEMCLATURE].Form.RecordSource = Me![NOMEMCLATURE].Form.RecordSource
End Sub |
Partager