Bonjour,
Je ne suis pas une expert sur ACESS et j'aimerais que l'on trouve une solution au problème suivant.
Je suis sous Access 2010. Un formulaire "Choix_Naissances" lié à la table "Naissances".
Dans ce formulaire j'ai 4 champs indépendants pour faire des filtres: Rnom...(voir code). Le filtre étant déclenché par un bouton "Recherche"
Cette fonction donne bien les résultats souhaités.
Je voudrais recopier la sélection effectuée avec ses filtres dans une autre table "Temp_Naissances" mais je n'arrive pas à trouver la solution.
Merci de me dépanner.
code VBA du bouton "Recherche" du formulaire "Choix_Naissances"
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50 Private Sub CmdFiltre_Click() On Error GoTo Err_CmdFiltre_Click Dim f As String f = "" 'recherche nom If Not IsNull(Me.RNom) And Me.RNom <> "" Then f = "Nom LIKE ""*" & Me.RNom & "*""" End If 'recherche prenom If Not IsNull(Me.RPrenom) And Me.RPrenom <> "" Then If f <> "" Then f = f & " AND Prenom LIKE ""*" & Me.RPrenom & "*""" Else f = "Prenom LIKE ""*" & Me.RPrenom & "*""" End If End If 'recherche nom mère If Not IsNull(Me.RNomM) And Me.RNomM <> "" Then If f <> "" Then f = f & " AND Prenom LIKE ""*" & Me.RPrenom & "*""" f = f & " AND NomM LIKE ""*" & Me.RNomM & "*""" Else f = "NomM LIKE ""*" & Me.RNomM & "*""" End If End If 'recherche commune If Not IsNull(Me.RLieu) And Me.RLieu <> "" Then If f <> "" Then f = f & " AND Prenom LIKE ""*" & Me.RPrenom & "*""" f = f & " AND NomM LIKE ""*" & Me.RNomM & "*""" f = f & " AND Lieu LIKE ""*" & Me.RLieu & "*""" Else f = "Lieu LIKE ""*" & Me.RLieu & "*""" End If End If Me.Filter = f Me.FilterOn = True Exit_CmdFiltre_Click: Exit Sub Err_CmdFiltre_Click: MsgBox Err.Description Resume Exit_CmdFiltre_Click End Sub
Partager