Bonjour,
J'ai un formulaire ou j'ai inseré :
- 2 Texte_box date
Dans ces 2 Texte_box, j'inscris une datedebut et une datefin en format francais jj/mm/aaaa hh:mm
- un bouton de commande
- une liste_box qui m'afficher un tableau avec des données
Tou fonctionne bien.
Mais je souhaiterais inserer dans ma listebox, les 2 dates que j'ai inseré dans les 2 Texte_box date.
En résumé , est il possible que les date inscrites dans les texte_box soient transférées dans la liste_box...
Voici le code vba
Merci d'avance
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
60
61
62
63
64 Option Compare Database 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 Private Sub Cmd_vrac_Click() Vdatedebut = CDate(Texte_datedebut) Vdatefin = CDate(Texte_DateFin) Vdatedebut = DateAuFormatUS(Me.Texte_datedebut) Vdatefin = DateAuFormatUS(Me.Texte_DateFin) With Me.Listevrac .RowSourceType = "Table/Requête" .ColumnCount = 3 ' nombre de colonne que dois avoir le formulaire .BoundColumn = 1 ' la colonne de reference strSQLSELECT = "SELECT CVDate(Fix([EventTIme]-(5/24))) AS [journée postale], dbo_vwParts.DisplayName AS Antennes, Count(dbo_vwItemEventHistory.ItemID) AS [Nbre colis injectés]" strSQLFROM = "FROM dbo_vwItemEventHistory INNER JOIN dbo_vwParts ON dbo_vwItemEventHistory.PartID = dbo_vwParts.ID" strSQLWHERE = "WHERE(((dbo_vwItemEventHistory.EventTime)>=" & Vdatedebut & " And (dbo_vwItemEventHistory.EventTime) <=" & Vdatefin & "))" strSQLGROUPBY = "GROUP BY dbo_vwParts.DisplayName, CVDate(Fix([EventTIme]-(5/24)))" strSQLHAVING = "HAVING (((dbo_vwParts.DisplayName) Like 'injection*'))" strSQLORDERBY = "ORDER BY dbo_vwParts.DisplayName;" txt_ChaineSQL = strSQLSELECT & vbCrLf & _ strSQLFROM & vbCrLf & _ strSQLWHERE & vbCrLf & _ strSQLGROUPBY & vbCrLf & _ strSQLHAVING & vbCrLf & _ strSQLORDERBY Debug.Print txt_ChaineSQL .RowSource = txt_ChaineSQL .Requery End With End Sub
Partager