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
| ==============================================
Private Sub RefreshQuery()
Dim SQL As String
Dim SQLWHERE As String
SQL = "SELECT Compteur, DateJournée, UARIBCOMPTE, NumOperation, Nom, TypeOP, Montant, Sens, CommentaireCRQ, NumDossierLAB FROM Tab_Comptes WHERE Tab_Comptes!Compteur <> 0"
If Not Me.chkTypeOp Then
SQL = SQL & "And Tab_Comptes!TypeOP = '" & Me.cmbRechType & "' "
End If
If Not Me.chkMontant Then
SQL = SQL & "And Tab_Comptes!Montant = " & Me.cmbRechMontant & ""
End If
If Not Me.chkNomClient Then
SQL = SQL & "And Tab_Comptes!NOM like '*" & Me.txtNomClient & "*' "
End If
If Not Me.chkDate1 Then
SQL = SQL & "And Tab_Comptes!DateJournée =#" & Format(Me.txtDate1, "mm/dd/yyyy") & "#"
End If
If Not Me.chkDate2 Then
SQL = SQL & "WHERE (((Tab_Comptes.DateJournée) Between #" & Format(Me.txtDate1, "mm/dd/yyyy") & "#" And "#" & Format(Me.txtDate2, "mm/dd/yyyy") & "#"""
End If
SQLWHERE = Trim(Right(SQL, Len(SQL) - InStr(SQL, "Where ") - Len("Where ") + 1))
SQL = SQL & ";"
Me.lblStats.Caption = DCount("*", "Tab_Comptes", SQLWHERE) & " / " & DCount("*", "Tab_Comptes")
Me.lstResults.RowSource = SQL
Me.lstResults.Requery
End Sub
---------------------------------------------------------------------------------------------------------------
Private Sub chkDate1_Click()
Me.txtDate1.Visible = Not Me.txtDate1.Visible
SendKeys "{Tab}"
If txtDate1 = "" Then
End
Else
RefreshQuery
End If
End Sub
----------------------------------------------------------------------------------------------------------------
Private Sub chkDate2_Click()
Me.txtDate2.Visible = Not Me.txtDate2.Visible
RefreshQuery
End Sub
----------------------------------------------------------------------------------------------------------------
Private Sub chkMontant_Click()
Me.cmbRechMontant.Visible = Not Me.cmbRechMontant.Visible
SendKeys "{Tab}"
cmbRechMontant = "0"
RefreshQuery
End Sub
----------------------------------------------------------------------------------------------------------------
Private Sub chkNomClient_Click()
Me.txtNomClient.Visible = Not Me.txtNomClient.Visible
txtNomClient.Value = ""
SendKeys "{Tab}"
RefreshQuery
End Sub
----------------------------------------------------------------------------------------------------------------
Private Sub chkTypeOp_Click()
Me.cmbRechType.Visible = Not Me.cmbRechType.Visible
cmbRechType.Value = ""
SendKeys "{Tab}"
RefreshQuery
End Sub
----------------------------------------------------------------------------------------------------------------
Private Sub cmbRechType_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 "lbl"
ctl.Caption = "- * - * -"
Case "txt"
ctl.Visible = False
ctl.Value = ""
Case "cmb"
ctl.Visible = False
End Select
Next ctl
Me.lstResults.RowSource = "SELECT Compteur, DateJournée, UARIBCOMPTE, NumOperation, NOM, TypeOp, Montant, Sens, CommentaireCRQ, NumDossierLAB FROM Tab_Comptes;"
Me.lstResults.Requery
End Sub
----------------------------------------------------------------------------------------------------------------
Private Sub lstResults_BeforeUpdate(Cancel As Integer)
RefreshQuery
End Sub
----------------------------------------------------------------------------------------------------------------
Private Sub lstResults_DblClick(Cancel As Integer)
DoCmd.OpenForm "F_AutoTab_Comptes", acNormal, , "[Compteur]=" & Me.lstResults
End Sub
----------------------------------------------------------------------------------------------------------------
Private Sub txtDate1_BeforeUpdate(Cancel As Integer)
RefreshQuery
End Sub
----------------------------------------------------------------------------------------------------------------
Private Sub txtDate2_BeforeUpdate(Cancel As Integer)
RefreshQuery
End Sub
----------------------------------------------------------------------------------------------------------------
Private Sub cmbRechMontant_AfterUpdate()
RefreshQuery
End Sub
----------------------------------------------------------------------------------------------------------------
Private Sub txtMontant_BeforeUpdate(Cancel As Integer)
RefreshQuery
End Sub
----------------------------------------------------------------------------------------------------------------
Private Sub txtNomClient_BeforeUpdate(Cancel As Integer)
RefreshQuery
End Sub
---------------------------------------------- |
Partager