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
| 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.lstresultat.RowSource = "SELECT libelle, numéro, date, P, i, e, u, rqt.resultat_pieu.[PIEU] FROM machine;"
Me.lstresultat.Requery
End Sub
Private Sub RefreshQuery()
Dim SQL As String
Dim SQLWhere As String
SQL = "SELECT numéro, p, i, e, u, date, rqt.resultat_pieu.[PIEU] libelle FROM machine Where machine!numéro <> 0 "
If Not Me.chklibelle Then
SQL = SQL & "And machine!libelle like '*" & Me.txtlibelle & "*' "
End If
If Not Me.chkdate Then
SQL = SQL & "And machine!date like '*" & Me.cmbdate & "*' "
End If
SQLWhere = Trim(Right(SQL, Len(SQL) - InStr(SQL, "Where ") - Len("Where ") + 1))
SQL = SQL & ";"
Me.lblstats.Caption = DCount("*", "machine", SQLWhere) & " / " & DCount("*", "Machine")
Me.lstresultat.RowSource = SQL
Me.lstresultat.Requery
End Sub
Private Sub lstResultat_DblClick(Cancel As Integer)
DoCmd.OpenForm "frmmachine", acNormal, , "[numéro] = " & Me.lstresultat |
Partager