Hi
I have a form where I have 6 comboboxes and a subform that will show the result for the query.
The query is pretty simple : get all the records that have one or more of the comboboxes value.
the values are in 2 tables so I used a INNER JOIN.
I have the 6th comboboxes that works as a independent one because when I click on it it will erase all the other ones and I would like that the subform only searches for that value.
Here is the code that I've been using to erase all other values of comboboxes :
Private Sub cboPO_Click()
Me.cboNom = ""
Me.cboNom.Requery
Me.cboDiscipline = ""
Me.cboDiscipline.Requery
Me.cboClient = ""
Me.cboClient.Requery
Me.cboProject = ""
Me.cboProject.Requery
Me.cboFamille = ""
Me.cboFamille.Requery
Me.cboPO.SetFocus
Call UpdateFields
End Sub
And the code (that doesn't work) to populate the query of the subform :
SELECT tblCommandes.PO, tblCommandes.[OR], tblCommandes.NoUltragen, tblCommandes.Client, tblCommandes.NoClient, tblCommandes.Nom, tblCommandes.Description, tblCommandes.ValeurPO, tblCommandes.ValeurREAL, [ValeurReal]-[ValeurPO] AS ValeurDiff, tblCommandes.LivraisonPrévu, tblCommandes.DateButoir, tblCommandes.LivraisonREAL, CalcWorkdays([LivraisonPrévu],[LivraisonREAL]) & " Jours" AS LivraisonDiff, tblCommandes.NoReception, tblCommandes.[Conformité Tech], tblCommandes.[Service QLTY], tblCommandes.[Service Ap/V], tblCommandes.Suivit, tblCommandes.Soumission, tblCommandes.Docs, tblCommandes.DocsLink, tblFournisseurs.Discipline, tblFournisseurs.Famille
FROM tblCommandes INNER JOIN tblFournisseurs ON tblCommandes.Nom = tblFournisseurs.Nom
WHERE (((tblCommandes.NoUltragen) =[Forms]![frmSelection]![cboProject]) OR isnull([Forms]![frmSelection]![cboProject]))
AND (((tblCommandes.Client)=[Forms]![frmSelection]![cboClient])OR isnull([Forms]![frmSelection]![cboClient]))
AND (((tblCommandes.Nom)=[Forms]![frmSelection]![cboNom])OR isnull([Forms]![frmSelection]![cboNom]))
AND (((tblFournisseurs.Discipline) =[Forms]![frmSelection]![cboDiscipline])OR isnull([Forms]![frmSelection]![cboDiscipline]))
AND (((tblFournisseurs.Famille)=[Forms]![frmSelection]![cboFamille])OR isnull([Forms]![frmSelection]![cboFamille]))
OR (((tblCommandes.PO)=[Forms]![frmSelection]![cboPO]));
it doesn't give anything and I don't understant why because I have information that should apear in the subform.
thanks
I have a form where I have 6 comboboxes and a subform that will show the result for the query.
The query is pretty simple : get all the records that have one or more of the comboboxes value.
the values are in 2 tables so I used a INNER JOIN.
I have the 6th comboboxes that works as a independent one because when I click on it it will erase all the other ones and I would like that the subform only searches for that value.
Here is the code that I've been using to erase all other values of comboboxes :
Private Sub cboPO_Click()
Me.cboNom = ""
Me.cboNom.Requery
Me.cboDiscipline = ""
Me.cboDiscipline.Requery
Me.cboClient = ""
Me.cboClient.Requery
Me.cboProject = ""
Me.cboProject.Requery
Me.cboFamille = ""
Me.cboFamille.Requery
Me.cboPO.SetFocus
Call UpdateFields
End Sub
And the code (that doesn't work) to populate the query of the subform :
SELECT tblCommandes.PO, tblCommandes.[OR], tblCommandes.NoUltragen, tblCommandes.Client, tblCommandes.NoClient, tblCommandes.Nom, tblCommandes.Description, tblCommandes.ValeurPO, tblCommandes.ValeurREAL, [ValeurReal]-[ValeurPO] AS ValeurDiff, tblCommandes.LivraisonPrévu, tblCommandes.DateButoir, tblCommandes.LivraisonREAL, CalcWorkdays([LivraisonPrévu],[LivraisonREAL]) & " Jours" AS LivraisonDiff, tblCommandes.NoReception, tblCommandes.[Conformité Tech], tblCommandes.[Service QLTY], tblCommandes.[Service Ap/V], tblCommandes.Suivit, tblCommandes.Soumission, tblCommandes.Docs, tblCommandes.DocsLink, tblFournisseurs.Discipline, tblFournisseurs.Famille
FROM tblCommandes INNER JOIN tblFournisseurs ON tblCommandes.Nom = tblFournisseurs.Nom
WHERE (((tblCommandes.NoUltragen) =[Forms]![frmSelection]![cboProject]) OR isnull([Forms]![frmSelection]![cboProject]))
AND (((tblCommandes.Client)=[Forms]![frmSelection]![cboClient])OR isnull([Forms]![frmSelection]![cboClient]))
AND (((tblCommandes.Nom)=[Forms]![frmSelection]![cboNom])OR isnull([Forms]![frmSelection]![cboNom]))
AND (((tblFournisseurs.Discipline) =[Forms]![frmSelection]![cboDiscipline])OR isnull([Forms]![frmSelection]![cboDiscipline]))
AND (((tblFournisseurs.Famille)=[Forms]![frmSelection]![cboFamille])OR isnull([Forms]![frmSelection]![cboFamille]))
OR (((tblCommandes.PO)=[Forms]![frmSelection]![cboPO]));
it doesn't give anything and I don't understant why because I have information that should apear in the subform.
thanks