A last question Paul, very similar:
I use forms and subforms always following the same pattern:
- Something like 10 listboxes in the form : the results are passed into a parameter in VBA.
- Then I run a SQL query in a VBA procedure using ADO: the parameters feed the WHERE clauses.
- The query populates a temporary table which is the date source of the subform
- The subform is refreshed
It is quite boring and long, it would be faster if I could use the query assistant of Access: but I was told it could be dangerous as I need to put the BE in SqlAzure:
In my code, for instance I replace things like "[Formulaires]![DSP_RDV_f_ConsultGestion_HistorRdv]![zlist_Professiont]" by string variables using loops , for example:
Set ctl_Profession = Nothing
Set ctl_Profession = Me.zlist_Profession
For Each var_Itm In ctl_Profession.ItemsSelected
If Len(str_CritereProfession) = 0 Then
str_CritereProfession = Chr(34) & ctl_Profession.ItemData(var_Itm) & Chr(34)
Else
str_CritereProfession = str_CritereProfession & "," & Chr(34) & ctl_Profession.ItemData(var_Itm) & Chr(34)
End If
Next var_Itm
Do you think the code below (it is only an example)would work between an access FE and a SqlAzure BE:
SELECT Contacts_t_ListeContacts.Nom_contact, Contacts_t_ListeContacts.Prenom_contact, Contacts_t_ListeContacts.ID_Contact, Contacts_t_ListeContacts.Fonction, Contacts_t_ListeContacts.Specialite, Contacts_t_ListeContacts.Statut_juridique, Contacts_t_ListeContacts.Profession, Contacts_t_ListeContacts.Adresse_1, Contacts_t_ListeContacts.Departement, Contacts_t_ListeContacts.Secteur, Contacts_t_ListeContacts.Case_du_plan, Contacts_t_ListeContacts.Ville, Contacts_t_ListeContacts.Tel1, Contacts_t_ListeContacts.Courriel, Contacts_t_ListeContacts.Commentaire
FROM Contacts_t_ListeContacts LEFT JOIN DSP_RDV_CR_t_CompteRendus ON Contacts_t_ListeContacts.[ID_Contact] = DSP_RDV_CR_t_CompteRendus.[FK_contact]
WHERE (((Contacts_t_ListeContacts.Profession)=[Formulaires]![DSP_RDV_f_ConsultGestion_HistorRdv]![zlist_Profession]) AND ((Contacts_t_ListeContacts.Departement)=[Formulaires]![DSP_RDV_f_ConsultGestion_HistorRdv]![zlist_Departement]) AND ((DSP_RDV_CR_t_CompteRendus.FK_contact) Is Null));
In a few words, it is quite a long work to work only in VBA and to populate all the subforms using ADO (or DAO) procedures: need to give values to variables, to test, tu run the queries, to create special events if the query is empty etc..
But it seems quite necessary tin my case, but maybe I am wrong on that..
Thanks in advance.
Etxe.