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
| Dim Vporte As String
Dim txt_ChaineSQL As String
Dim strSQLSELECT As String
Dim strSQLFROM As String
Dim strSQLWHERE As String
Dim strSQLGROUPBY As String
Dim strSQLHAVING As String
Dim strSQLORDERBY As String
Dim objSpeech As Object
Dim strPhrase As String
Dim intPitch As Integer
Private Sub Cmd_vrac_Click()
Dim strInsert As String
Vdatedebut = DateAuFormatUS(Me.Texte_DateDebut)
Vdatefin = DateAuFormatUS(Me.Texte_dateFin)
Vdatedebut = CDate(Texte_DateDebut)
Vdatefin = CDate(Texte_dateFin)
Vporte = Val(Texte_porte)
With Me.Liste_Vrac
.RowSourceType = "Table/Requête"
.ColumnCount = 7 ' nombre de colonne que dois avoir le formulaire
.BoundColumn = 1 ' la colonne de reference
strSQLSELECT = "SELECT CVDate(Fix(([EventTime]-5/24))) AS journee, Min(dbo_vwItemEventHistory.EventTime) AS [heure debut], Max(dbo_vwItemEventHistory.EventTime) AS [heure fin], T_vracs.PFC_Destinataire, T_vracs.PORTE, Count(dbo_vwItemEventHistory.ItemID) AS CompteDeItemID, Date() AS creationDate "
strSQLFROM = "FROM ((dbo_vwItemEventHistory INNER JOIN dbo_vwParts ON dbo_vwItemEventHistory.PartID = dbo_vwParts.ID) INNER JOIN [table_Affich-general] ON dbo_vwParts.DisplayName = [table_Affich-general].[Chute (format access)]) INNER JOIN T_vracs ON [table_Affich-general].[Nom Porte principale] = T_vracs.PFC_Destinataire "
strSQLWHERE = "WHERE (((dbo_vwItemEventHistory.ItemEventTypeID) = 4) And ((dbo_vwItemEventHistory.ResultTypeID) = 23) And (([table_Affich-general].Allée) = 'vrac') AND (dbo_vwItemEventHistory.EventTime) >=#" & Format(Vdatedebut, "MM/dd/yyyy HH:mm") & "# And (dbo_vwItemEventHistory.EventTime) <=#" & Format(Vdatefin, "MM/dd/yyyy HH:mm") & "#) "
strSQLGROUPBY = "GROUP BY CVDate(Fix(([EventTime]-5/24))), T_vracs.PORTE, T_vracs.PFC_Destinataire "
strSQLHAVING = "HAVING ((T_vracs.PORTE) = '" & Vporte & "');"
txt_ChaineSQL = strSQLSELECT & vbCrLf & _
strSQLFROM & vbCrLf & _
strSQLWHERE & vbCrLf & _
strSQLGROUPBY & vbCrLf & _
strSQLHAVING & vbCrLf & _
strSQLORDERBY
strInsert = "INSERT INTO maTableTemporaire (journee, heure_debut, heure_fin, PFC_Destinataire,PORTE, nbItems,creationDate) " & txt_ChaineSQL
Debug.Print strInsert
.RowSource = strInsert
.Requery
End With
End Sub |
Partager