Solved Filter by criteria or by name: SQL VBA WHERE LIKE used to Form.Filter rather than new recordset (1 Viewer)

Etxezarreta

Member
Local time
Today, 17:03
Joined
Apr 13, 2020
Messages
175
Hello everyone,

In order to update one table (t_AffectationProjetA_Contacts), I populate a temporary table (t_ConsultationContactProjet_temp_modiftableprincipale) with a VBA SQL query in the form f_ConsultationGestionContacts _Projets: I select different criteria in 5 list zones-> populate the subform linked to the temporary table (t_ConsultationContactProjet_temp_modiftableprincipale) -> the user can modify some data in the subform -> he validates-> updates the final table (t_AffectationProjetA_Contacts): this works just fine.
I use a temporary table because the final one is very "condensate": only primary key and foreign keys, nothing explicit to be dealt with directly in a form.
I would like to enable the user to find a contact by anotherway, from the same form: he writes some letters in a textbox (txt_SaisieNomPourRecherche) and thanks to the "change" event-> a query runs and filters the subform, with a WHERE LIKE value of the text box: I prefer a filtration rather than a creation of a new recordset.
I have been trying this out for hours: no way.. (you will find the code in f_ConsultationGestionContacts _Projets-> Sub txt_SaisieNomPourRecherche_change)
Could you please help me?
Many thanks.
Etxe.
 

Attachments

  • Filter by criteria OR by name.zip
    2.2 MB · Views: 96

bastanu

AWF VIP
Local time
Today, 09:03
Joined
Apr 13, 2010
Messages
1,401
Please have a look at the attached, is that what you want?

Cheers,
 

Attachments

  • Filter by criteria OR by name_Vlad.zip
    146.3 KB · Views: 100

Etxezarreta

Member
Local time
Today, 17:03
Joined
Apr 13, 2020
Messages
175
Please have a look at the attached, is that what you want?

Cheers,
Vlad,
This is exactly what I was looking for: the [ ] means that it works directly in the subform doesn't it?
Thanks a lot.
Etxe.
 

Gasman

Enthusiastic Amateur
Local time
Today, 16:03
Joined
Sep 21, 2011
Messages
14,059
This is very interesting, thanks. I will try to use it, not so easy though.
Well actually it is. You copy some code and about one line for each control and it just works. ! :)
 

Users who are viewing this thread

Top Bottom