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 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210
|
Option Compare Database
Private Sub btnDate_Click()
Me.zdtRechDate.Value = InputBoxDate("Entrez une date", , Nz(zdtRechDate.Value, Now()), , , , , , , "Comic sans MS", 12)
RefreshQuery
End Sub
Private Sub btnDatedebut_Click()
Me.zdtdatedebut.Value = InputBoxDate("Entrez une date", , Nz(zdtdatedebut.Value, Now()), , , , , , , "Comic sans MS", 12)
RefreshQuery
End Sub
Private Sub btnDatefin_Click()
Me.zdtdatefin.Value = InputBoxDate("Entrez une date", , Nz(zdtdatefin.Value, Now()), , , , , , , "Comic sans MS", 12)
RefreshQuery
End Sub
Private Sub chkDateBon_Click()
If Me.chkDateBon Then
Me.zdtRechDate.Visible = False
Me.btnDate.Visible = False
Else
Me.zdtRechDate.Visible = True
Me.btnDate.Visible = True
End If
RefreshQuery
End Sub
Private Sub chkFourn_Click()
If Me.chkFourn Then
Me.cmbRechFourn.Visible = False
Else
Me.cmbRechFourn.Visible = True
End If
RefreshQuery
End Sub
Private Sub chkNumeroBon_Click()
If Me.chkNumeroBon Then
Me.txtRechNum.Visible = False
Else
Me.txtRechNum.Visible = True
End If
RefreshQuery
End Sub
Private Sub chkperiode_Click()
If Me.chkperiode Then
Me.zdtdatedebut.Visible = False
Me.zdtdatefin.Visible = False
Me.btnDatedebut.Visible = False
Me.btnDatefin.Visible = False
Else
Me.zdtdatedebut.Visible = True
Me.zdtdatefin.Visible = True
Me.btnDatedebut.Visible = True
Me.btnDatefin.Visible = True
End If
RefreshQuery
End Sub
Private Sub cmbRechFourn_BeforeUpdate(Cancel As Integer)
RefreshQuery
End Sub
Private Sub lstResults_DblClick(Cancel As Integer)
DoCmd.OpenForm "frmAutoBon", acNormal, , "[RefBon]=" & Me.lstResults
End Sub
Private Sub zdtdatedebut_BeforeUpdate(Cancel As Integer)
RefreshQuery
End Sub
Private Sub zdtdatefin_BeforeUpdate(Cancel As Integer)
RefreshQuery
End Sub
Private Sub zdtRechDate_BeforeUpdate(Cancel As Integer)
RefreshQuery
End Sub
Private Sub txtRechNum_BeforeUpdate(Cancel As Integer)
RefreshQuery
End Sub
Private Sub RefreshQuery()
Dim SQL As String
Dim SQLWhere As String
SQL = " SELECT [RefBon],[NumBon],[DateBon],[Fournisseur],[Total] FROM [rqttblboncommande1] Where [rqttblboncommande1]![RefBon] <> 0 "
If Not Me.chkNumeroBon Then
SQL = SQL & " And [rqttblboncommande1]![NumBon]= " & Me.txtRechNum
End If
If Not Me.chkDateBon Then
SQL = SQL & " And [rqttblboncommande1]![DateBon] = #" & Format(Me.zdtRechDate, " mm/dd/yyyy ") & "#"
End If
If Not Me.chkFourn Then
SQL = SQL & " And [rqttblboncommande1]![Fournisseur] = '" & Me.cmbRechFourn & "' "
End If
If Not Me.chkperiode Then
SQL = SQL & "And [rqttblboncommande1]![DateBon] Between #" & Format(Me.zdtdatedebut, " mm/dd/yyy ") & "# And #" & Format(Me.zdtdatefin, " mm/dd/yyyy ") & "#"
End If
SQLWhere = Trim(Right(SQL, Len(SQL) - InStr(SQL, "Where ") - Len("Where ") + 1))
SQL = SQL & ";"
Me.lblStats.Caption = DCount("*", "[rqttblboncommande1]", SQLWhere) & " / " & DCount("*", "[rqttblboncommande1]")
Me.lstResults.RowSource = SQL
Me.lstResults.Requery
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 "lbl"
ctl.Caption = "- * - * -"
Case "txt"
ctl.Visible = False
ctl.Value = 0
Case "zdt"
ctl.Visible = False
ctl.Value = Now()
Case "cmb"
ctl.Visible = False
Case "btn"
ctl.Visible = False
End Select
Next ctl
Me.lstResults.RowSource = "SELECT RefBon, NumBon, DateBon, Fournisseur, Total FROM [rqttblboncommande1];"
Me.lstResults.Requery
End Sub
Private Sub Commande33_Click()
On Error GoTo Err_Commande33_Click
DoCmd.Close
Exit_Commande33_Click:
Exit Sub
Err_Commande33_Click:
MsgBox Err.Description
Resume Exit_Commande33_Click
End Sub
Private Sub Commande43_Click()
On Error GoTo Err_Commande43_Click
Dim stDocName As String
stDocName = "etatrqtbon1"
DoCmd.OpenReport stDocName, acPreview
Exit_Commande43_Click:
Exit Sub
Err_Commande43_Click:
MsgBox Err.Description
Resume Exit_Commande43_Click
End Sub |
Partager