Solved Syntax to populate a querydef with VBA using ADO (1 Viewer)

Etxezarreta

Member
Local time
Today, 15:21
Joined
Apr 13, 2020
Messages
175
Hi All,

I want to populate an existing query with some vba code, but the compliation shows me an error: I habe been looking for an answer in the forum, but still clueless, any suggestion please?
May thanks!

Code:
            str_SQL_finale = " SELECT t_ListeContacts.ID_Contact, t_ListeContacts.Nom_contact, t_ListeContacts.Prenom_contact, re_DernRdv.MaxDeDate_rdv AS DateDernRdv, t_ListeContacts.Nom_structure, t_ListeContacts.Fonction, t_Specialite.Specialite, t_IntitulesProfession.Profession, t_ListeContacts.Ville, t_ListeContacts.Departement, t_ListeContacts.Adresse_1" _
                            & " FROM t_Specialite INNER JOIN (t_IntitulesProfession INNER JOIN (t_ListeContacts INNER JOIN re_DernRdv ON t_ListeContacts.ID_Contact = re_DernRdv.FK_contact) ON t_IntitulesProfession.ID_Profession = t_ListeContacts.FK_Profession) ON t_Specialite.ID_Specialite = t_ListeContacts.FK_Specialite" _
                            & " WHERE " & strAllCriteria & " "
            
            objConnection.Execute (str_SQL_finale)

QueryDefs("reCrRdv").SQL = str_SQL_finale 'HERE IS MY PROBLEM'

Me.Refresh
objConnection.Close
Set objConnection = Nothing
 

Isaac

Lifelong Learner
Local time
Today, 07:21
Joined
Mar 14, 2017
Messages
8,738
What's the compile error and what line does it highlight? Maybe you need a Currentdb. in front of QueryDefs
 

Etxezarreta

Member
Local time
Today, 15:21
Joined
Apr 13, 2020
Messages
175
ok, it works well, many thanks!
Etxe.
 

Users who are viewing this thread

Top Bottom