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 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232
| Private Sub CHKSTARTDATE_Click()
If Me.CHKSTARTDATE Then
Me.TXTSTARTDATE.Visible = False
Else
Me.TXTSTARTDATE.Visible = True
End If
End Sub
Private Sub CHKENDDATE_Click()
If Me.CHKENDDATE Then
Me.TXTENDDATE.Visible = False
Else
Me.TXTENDDATE.Visible = True
End If
RefreshQuery
End Sub
Private Sub CHKREF_Click()
If Me.CHKREF Then
Me.TXTREF.Visible = False
Else
Me.TXTREF.Visible = True
End If
RefreshQuery
End Sub
Private Sub CHKCUSTOMER_Click()
If Me.CHKCUSTOMER Then
Me.CMBCUSTOMER.Visible = False
Else
Me.CMBCUSTOMER.Visible = True
End If
RefreshQuery
End Sub
Private Sub CHKREP_Click()
If Me.CHKREP Then
Me.CMBREP.Visible = False
Else
Me.CMBREP.Visible = True
End If
RefreshQuery
End Sub
Private Sub CHKGRADE_Click()
If Me.CHKGRADE Then
Me.CMBGRADE.Visible = False
Else
Me.CMBGRADE.Visible = True
End If
RefreshQuery
End Sub
Private Sub CHKGROUP_Click()
If Me.CHKGROUP Then
Me.CMBGROUP.Visible = False
Else
Me.CMBGROUP.Visible = True
End If
RefreshQuery
End Sub
Private Sub CHKMARKET_Click()
If Me.CHKMARKET Then
Me.CMBMARKET.Visible = False
Else
Me.CMBMARKET.Visible = True
End If
RefreshQuery
End Sub
Private Sub CHKORDER_Click()
If Me.CHKORDER Then
Me.CMBORDER.Visible = False
Else
Me.CMBORDER.Visible = True
End If
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 "LBL"
ctl.Caption = "- * - * -"
Case "TXT"
ctl.Visible = False
ctl.Value = ""
Case "CMB"
ctl.Visible = False
End Select
Next ctl
Me.LSTRESULTS.RowSource = "SELECT ID, REF, CUSTOMER, GROUP, MARKET, REP, QUOTEDATE, GRADE, SHAPE, SIZEINMM, WEIGHT, ORDER FROM R_RECHERCHE;"
Me.LSTRESULTS.Requery
End Sub
Private Sub RefreshQuery()
Dim SQL As String
Dim SQLWhere As String
SQL = "SELECT ID, REF, CUSTOMER, GROUP, MARKET, REP, QUOTEDATE, GRADE, SHAPE, SIZEINMM, WEIGHT, ORDER FROM R_RECHERCHE Where R_RECHERCHE!ID <> 0"
If Not Me.CHKSTARTDATE Then
SQL = SQL & "And R_RECHERCHE!QUOTEDATE >= '" & Format(Me.TXTSTARTDATE, "dd/mm/yyyy") & "' "
End If
If Not Me.CHKENDDATE Then
SQL = SQL & "And R_RECHERCHE!QUOTEDATE <= '" & Format(Me.TXTENDDATE, "dd/mm/yyyy") & "' "
End If
If Not Me.CHKREF Then
SQL = SQL & "And R_RECHERCHE!REF = '" & Me.TXTREF & "' "
End If
If Not Me.CHKCUSTOMER Then
SQL = SQL & "And R_RECHERCHE!CUSTOMER = '" & Me.CMBCUSTOMER & "' "
End If
If Not Me.CHKREP Then
SQL = SQL & "And R_RECHERCHE!REP = '" & Me.CMBREP & "' "
End If
If Not Me.CHKGRADE Then
SQL = SQL & "And R_RECHERCHE!GRADE = '" & Me.CMBGRADE & "' "
End If
If Not Me.CHKGROUP Then
SQL = SQL & "And R_RECHERCHE!GROUP = '" & Me.CMBGROUP & "' "
End If
If Not Me.CHKMARKET Then
SQL = SQL & "And R_RECHERCHE!MARKET = '" & Me.CMBMARKET & "' "
End If
If Not Me.CHKORDER Then
SQL = SQL & "And R_RECHERCHE!ORDER = '" & Me.CMBORDER & "' "
End If
SQLWhere = Trim(Right(SQL, Len(SQL) - InStr(SQL, "Where ") - Len("Where ") + 1))
SQL = SQL & ";"
Me.LBLSTATS.Caption = DCount("*", "R_RECHERCHE", SQLWhere) & " / " & DCount("*", "R_RECHERCHE")
Me.LSTRESULTS.RowSource = SQL
Me.LSTRESULTS.Requery
End Sub
Private Sub LSTRESULTS_DblClick(Cancel As Integer)
DoCmd.OpenForm "F_MODIFICATION", acNormal, , "[ID] = " & Me.LSTRESULTS
End Sub
Private Sub TXTSTARTDATE_BeforeUpdate(Cancel As Integer)
RefreshQuery
End Sub
Private Sub TXTENDDATE_BeforeUpdate(Cancel As Integer)
RefreshQuery
End Sub
Private Sub TXTREF_BeforeUpdate(Cancel As Integer)
RefreshQuery
End Sub
Private Sub CMBCUSTOMER_BeforeUpdate(Cancel As Integer)
RefreshQuery
End Sub
Private Sub CMBREP_BeforeUpdate(Cancel As Integer)
RefreshQuery
End Sub
Private Sub CMBGRADE_BeforeUpdate(Cancel As Integer)
RefreshQuery
End Sub
Private Sub CMBGROUP_BeforeUpdate(Cancel As Integer)
RefreshQuery
End Sub
Private Sub CMBMARKET_BeforeUpdate(Cancel As Integer)
RefreshQuery
End Sub
Private Sub CMBORDER_BeforeUpdate(Cancel As Integer)
RefreshQuery
End Sub |
Partager