E
ericb
I have a form on which is a subform and 5 commands buttons.
On the click of a button, I want to change the records shown on the subform.
I am having a problem with one of those buttons.
One is suppose to show records of costumers that came between 2 dates. To do
so I made a table with 3 fields :ID, date_1, date_2.
date_1 and date_2 are date/time variables.
I also made a small form that changes those dates and with an OK button.
The command button opens the small date subform.
On the click of the OK button on the small subform I go into this procedure :
' A défini les dates et va updater la subform avec les records sur une
période de temps
Private Sub OK_Click()
'Ma query
Dim mySQL As String
Dim date_debut As String
Dim date_fin As String
Dim cmdWhere As String
date_debut = [date_1].Value
date_fin = [date_2].Value
cmdWhere = " WHERE (((Produit.date_livraison) Between " + date_debut + " And
" + date_fin + "))"
'cmdWhere = " WHERE (((Produit.date_livraison) Between [date_low] And [
date_high]))"
'to view the string
MsgBox cmdWhere
mySQL = "SELECT DISTINCT [Client Extended].ID_client, [Client
Extended].date_ouverture, [Client Extended].nom_client, [Client
Extended].date_naissance, [Client Extended].couriel"
mySQL = mySQL + " FROM [Client Extended] RIGHT JOIN Produit ON [Client
Extended].ID_client=Produit.REF_client"
mySQL = mySQL + cmdWhere
mySQL = mySQL + " GROUP BY [Client Extended].ID_client, [Client
Extended].date_ouverture, [Client Extended].nom_client, [Client
Extended].date_naissance, [Client Extended].couriel"
mySQL = mySQL + " ORDER BY [Client Extended].nom_client"
Forms![Home Base]![Liste Client HB subform].Form.RecordSource = mySQL
'Me![Liste Client HB subform].Form.FilterOn = True
' Ferme le formulaire et sauve les dates de la période de temps de recherche
'DoCmd.Close acForm, "Introduire la période de temps", acSaveYes
End Sub
The present cmdWhere those not work and the commented one does. When I look
at the strings they both look the same but results are not the same, why?
I would like to use the subform to change the dates and not have Access
prompt for two dates.
Thank you for the help.
On the click of a button, I want to change the records shown on the subform.
I am having a problem with one of those buttons.
One is suppose to show records of costumers that came between 2 dates. To do
so I made a table with 3 fields :ID, date_1, date_2.
date_1 and date_2 are date/time variables.
I also made a small form that changes those dates and with an OK button.
The command button opens the small date subform.
On the click of the OK button on the small subform I go into this procedure :
' A défini les dates et va updater la subform avec les records sur une
période de temps
Private Sub OK_Click()
'Ma query
Dim mySQL As String
Dim date_debut As String
Dim date_fin As String
Dim cmdWhere As String
date_debut = [date_1].Value
date_fin = [date_2].Value
cmdWhere = " WHERE (((Produit.date_livraison) Between " + date_debut + " And
" + date_fin + "))"
'cmdWhere = " WHERE (((Produit.date_livraison) Between [date_low] And [
date_high]))"
'to view the string
MsgBox cmdWhere
mySQL = "SELECT DISTINCT [Client Extended].ID_client, [Client
Extended].date_ouverture, [Client Extended].nom_client, [Client
Extended].date_naissance, [Client Extended].couriel"
mySQL = mySQL + " FROM [Client Extended] RIGHT JOIN Produit ON [Client
Extended].ID_client=Produit.REF_client"
mySQL = mySQL + cmdWhere
mySQL = mySQL + " GROUP BY [Client Extended].ID_client, [Client
Extended].date_ouverture, [Client Extended].nom_client, [Client
Extended].date_naissance, [Client Extended].couriel"
mySQL = mySQL + " ORDER BY [Client Extended].nom_client"
Forms![Home Base]![Liste Client HB subform].Form.RecordSource = mySQL
'Me![Liste Client HB subform].Form.FilterOn = True
' Ferme le formulaire et sauve les dates de la période de temps de recherche
'DoCmd.Close acForm, "Introduire la période de temps", acSaveYes
End Sub
The present cmdWhere those not work and the commented one does. When I look
at the strings they both look the same but results are not the same, why?
I would like to use the subform to change the dates and not have Access
prompt for two dates.
Thank you for the help.