Afficher une date au format français dans une Texte_box
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
- une liste_box qui normalement doit m'afficher un tableau avec des données
Le soucis, c'est que, lorsque j'affiche la datedebut et la datefin en format francais, ma liste_box reste vide.
Et lorsque j'affiche la datedebut et la datefin en format anglais ( mm/jj/aaaa hh:mm), les données s'affichent dans ma liste box.
Comment faire en sorte, que ma liste_box m'affiche les données avec une datedebut et une datefin en format francais jj/mm/aaaa hh:mm
Merci d'avance de votre aide
Voici mon code vba
Code:
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 65 66 67 68 69 70
| Option Compare Database
Dim Vdatedebut As Date
Dim Vdatefin As Date
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)
MsgBox (Vdatedebut)
MsgBox (Vdatefin)
With Me.Listevrac
.RowSourceType = "Table/Requête"
.ColumnCount = 5 ' nombre de colonne que dois avoir le formulaire
.BoundColumn = 1 ' la colonne de reference
strSQLSELECT = "SELECT 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)>=#" & Format(Vdatedebut, "dd/mm/yyyy HH:mm:ss") & "# And (dbo_vwItemEventHistory.EventTime) <=#" & Format(Vdatefin, "dd/mm/yyyy HH:mm:ss") & "#))"
strSQLGROUPBY = "GROUP BY dbo_vwParts.DisplayName"
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
MsgBox txt_ChaineSQL
Debug.Print txt_ChaineSQL
.RowSource = txt_ChaineSQL
.Requery
End With
End Sub |