Private Sub RefreshQuery()
Dim SQL As String
Dim SQLWhere As String
SQL = "SELECT code_entreprise, Nom, Pays, Type, Fil_consommé, Fil_distribué FROM Entreprises Where Entreprises!code_entreprise <> 0 "
If Not Me.chkpays Then
SQL = SQL & "And Entreprises!Pays = '" & Me.cmbpays & "' "
End If
If Not Me.chkType Then
SQL = SQL & "And Entreprises!Type = '" & Me.cmbtype & "' "
End If
If Not Me.chkfilconso Then
SQL = SQL & "And Entreprises!Fil_consommé = '" & Me.cmbfilconso & "' "
End If
If Not Me.chkfildistri Then
SQL = SQL & "And Entreprises!Fil_distribué = '" & Me.cmbfildistri & "' "
End If
If Not Me.chknom Then
SQL = SQL & "And Entreprises!Nom like '*" & Me.txtnom & "*' "
End If
SQLWhere = Trim(Right(SQL, Len(SQL) - InStr(SQL, "Where ") - Len("Where ") + 1))
SQL = SQL & ";"
'Me.lblStats.Caption = DCount("*", "Entreprises", SQLWhere) & "/" & DCount("*", "Entreprises")
Me.lstResults.RowSource = SQL
Me.lstResults.Requery
End Sub
Partager