1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
|
Public Sub RefreshQuery()
Dim sql As String, sqlCompteur As String, sqlSelect As String, sqlFrom As String, sqlWhere As String
Dim DateFin As Date, DateDébut As Date
Dim oRst As DAO.Recordset
Dim odb As DAO.Database
Set odb = CurrentDb
DateFin = "12/12/5000"
DateDébut = "10/10/1901"
sqlSelect = "SELECT tbl_Intervention.Id_Intervention, tbl_Intervention.DateIntervention, tbl_Personnel.Identite, tbl_Ligne.Ligne, tbl_Machine.Machine, tbl_Type.Type, tbl_Categorie.Categorie, tbl_SousEnsemble.SousEnsemble, tbl_Element.Element, tbl_Intervention.Descriptif, tbl_Diagnostic.Diagnostic, tbl_Intervention.DureeIntervention, tbl_Intervention.DureeArretMachine"
sqlFrom = "FROM ((((((tbl_Ligne INNER JOIN ((tbl_Intervention INNER JOIN tbl_Intervenir ON tbl_Intervention.Id_Intervention = tbl_Intervenir.Id_Intervention) INNER JOIN tbl_Machine ON tbl_Intervention.Id_Machine = tbl_Machine.Id_Machine) ON tbl_Ligne.Id_Ligne = tbl_Machine.Id_Ligne) INNER JOIN tbl_Type ON tbl_Intervention.Id_Type = tbl_Type.Id_Type) INNER JOIN tbl_Categorie ON tbl_Intervention.Id_Categorie = tbl_Categorie.Id_Categorie) INNER JOIN tbl_SousEnsemble ON tbl_Intervention.Id_SousEnsemble = tbl_SousEnsemble.Id_SousEnsemble) INNER JOIN tbl_Element ON (tbl_Intervention.Id_Element = tbl_Element.Id_Element) AND (tbl_Categorie.Id_Categorie = tbl_Element.Id_Categorie)) INNER JOIN tbl_Diagnostic ON tbl_Intervention.Id_Diagnostic = tbl_Diagnostic.Id_Diagnostic) INNER JOIN tbl_Personnel ON tbl_Intervenir.Id_Personnel = tbl_Personnel.Id_Personnel"
sqlWhere = "WHERE (((tbl_Intervention.Id_Intervention)<>0))"
sql = sqlSelect + sqlFrom + sqlWhere
Me.lstResults.RowSource = sql & " ORDER BY tbl_Intervention.DateIntervention DESC"
Me.lstResults.Requery
End Sub |
Partager