Bonjour,
Avec le code suivant, j'ai toujours la réponse enregistrement trouvé.
Si c'est vrai, Access trouve vraiment le code, si je décoche 'strFusion = "EREETR", il trouve aussi mais le Msgbox reste vide.
Ou se trouve mon erreur svp. Je pourrais tester avec résultat vide ou pas, mais ce n'est pas parfait !
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 Private Sub Texte13_Click() Dim strSousCategorie As String Dim strCategorie As String Dim strFusion As String strCategorie = Me.txt_Categorie strSousCategorie = Me.txt_SousCategorie strFusion = strCategorie & strSousCategorie Dim dbs As DAO.Database Dim Enr As DAO.Recordset 'Get the database and Recordset Set dbs = CurrentDb 'Set rst = dbs.OpenRecordset("r_ChampFusion") Set rst = CurrentDb.OpenRecordset("r_ChampFusion", dbOpenDynaset) 'strFusion = "EREETR" 'Search for the first matching record If Not IsNull(strSousCategorie) Then rst.FindFirst "[ChampFusion] = '" & strFusion & "'" If Me.RecordsetClone.NoMatch Then MsgBox "enregistrement non trouvé" MsgBox rst("ChampFusion") Else MsgBox "enregistrement trouvé" MsgBox rst("ChampFusion") 'Me.Bookmark = Me.RecordsetClone.Bookmark End If End If rst.Close Set rst = Nothing Set dbs = Nothing End Sub
Partager