Bonjour à tous,
Dans cmd_recherche, j'aimerais bien savoir le code qui permet à ajouter la fonctionnalité de correspondance à un textbox lié à une base de donnée access.
c-à-d, si je chercher un nom, je veux quand je commence à saisir les premiers caractères , on me propose les noms qui commencent par ces caractères . (c'est la fonctionnalité qu'on trouve dans excel)
Voici le code dont je me sert dans cmd_recherche

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
On Error Resume Next
     If Text1.Text = "" Then
       MsgBox "Veuiller saisir un nom à rechercher", vbInformation + _
                     vbMsgBoxRtlReading + vbOKOnly, "Attention"
End If
 
If Text1.Text <> "" Then
If IsNumeric(Text1) = False Then
    Set RS = New ADODB.Recordset
RS.Open "select * from patient where nom like '%" & Text1.Text & "%' And prenom like '%" & Text2.Text & "%'", DB, adOpenStatic, adLockOptimistic
       If RS.RecordCount > 0 Then
 
 Text1.Text = RS!Nom
 Text2.Text = RS!Prenom
 Text3.Text = RS!age
 Text4.Text = RS!date
 Text5.Text = RS!diagnostic
 Text6.Text = RS!plan
 Text7.Text = RS!obs
 Else
   MsgBox "Aucun patient avec ce nom", vbInformation + _
                     vbMsgBoxRtlReading + vbOKOnly, "Attention"
    End If
    Text1.SetFocus
End If
End If
merci à tous