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
|
Option Compare Database
Option Explicit
Private Sub chkCdeArticle_Click()
If Me.chkCdeArticle Then
Me.txtCdeArticle.Visible = False
Else
Me.txtCdeArticle.Visible = True
End If
End Sub
Private Sub chkGestionnaire_Click()
If Me.chkGestionnaire Then
Me.cmbGestionnaire.Visible = False
Else
Me.cmbGestionnaire.Visible = True
End If
End Sub
Private Sub chkOF_Click()
If Me.chkOF Then
Me.cmbOF.Visible = False
Else
Me.cmbOF.Visible = True
End If
End Sub
Private Sub cmbGestionnaire_BeforeUpdate(Cancel As Integer)
RefreshQuery
End Sub
Private Sub cmbOF_BeforeUpdate(Cancel As Integer)
RefreshQuery
End Sub
Private Sub Form_Load()
Dim ctl As Control
For Each ctl In Me.Controls
Select Case Left(ctl.Name, 3)
Case "chk"
ctl.Value = -1
Case "txt"
ctl.Visible = False
ctl.Value = ""
Case "cmb"
ctl.Visible = False
End Select
Next ctl
Me.lstResultat.RowSource = "SELECT Num, OF, Gestionnaire, CodeArticle, QteOrdre, Cause, Dateappro FROM tblSauvegardeTraitementCauseRetard;"
Me.lstResultat.Requery
End Sub
Private Sub RefreshQuery()
Dim SQL As String
SQL = " SELECT Num, OF, Gestionnaire, CodeArticle, QteOrdre, Cause, Dateappro FROM tblSauvegardeTraitementCauseRetard"
If Not Me.chkGestionnaire Then
SQL = SQL & "AND tblSauvegardeTraitementCauseRetard!Gestionnaire = ' " & Me.cmbGestionnaire & " ' " ' c'est un champ texte
End If
If Not Me.chkOF Then
SQL = SQL & " AND tblSauvegardeTraitementCauseRetard!OF = ' " & Me.cmbOF & " ' " ' c'est un champ texte
End If
If Not Me.chkCdeArticle Then
SQL = SQL & " AND tblSauvegardeTraitementCauseRetard!CodeArticle = ' * " & Me.txtCdeArticle & " * ' " ' c'est champ texte
End If
SQL = SQL & ";"
Me.lstResultat.RowSource = "SELECT Num, OF, Gestionnaire, CodeArticle, QteOrdre, Cause, Dateappro FROM tblSauvegardeTraitementCauseRetard AND tblSauvegardeTraitementCauseRetard!Gestionnaire = ' " & Me.cmbGestionnaire & " '; "
Me.lstResultat.Requery
End Sub
Private Sub txtCdeArticle_BeforeUpdate(Cancel As Integer)
RefreshQuery
End Sub |
Partager