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
| Private Sub RefreshQuery()
Dim SQL As String
Dim SQLWhere As String
SQL = "SELECT Clients.Raison_soc, Projet.Projet, Projet.Année, TypeBande.TypeBande, Archive.NoBande, Archive.Date_archivage FROM TypeBande INNER JOIN (Archive INNER JOIN (Clients INNER JOIN Projet ON Clients.Ref_clt = Projet.Client) ON Archive.N° = Projet.N°_archive) ON TypeBande.N° = Archive.Typebande Where Projet!Client <> 0"
If Not Me.chkTitre Then
SQL = SQL & "And Projet!Projet like '*" & Me.txtRechTitre & "*' "
End If
If Not Me.chkSoc Then
SQL = SQL & "And Projet!Client like '*" & Me.txtRechSoc & "*' "
End If
If Not Me.chkYear Then
SQL = SQL & "And Projet!Année like '*" & Me.txtRechYear & "*' "
End If
If Not Me.chkTypeBande Then
SQL = SQL & "And TypeBande!TypeBande like '*" & Me.txtRechTypeBande & "*' "
End If
If Not Me.chkNoBande Then
SQL = SQL & "And Archive!NoBande like '*" & Me.txtRechNoBande & "*' "
End If
SQLWhere = Trim(Right(SQL, Len(SQL) - InStr(SQL, "Where ") - Len("Where ") + 1))
SQL = SQL & ";"
Me.lblStats.Caption = DCount("*", "Projet", SQLWhere) & " / " & DCount("*", "Projet")
Me.lstResults.RowSource = SQL
Me.lstResults.Requery
End Sub |
Partager