quels résultats peuvent être masqués par UCase?
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionDim sTemp As String sTemp = "SELECT [Dénomination] FROM [Produits] WHERE [Dénomination] LIKE '%" & Textbox1 & "%'" Debug.Print sTemp ' Colle nous le texte généré dans la fenêtre de debug) Set re = bds.OpenRecordset(sTemp)
Set bds = OpenDatabase("F:\Users\Romain\Desktop\Management\Base de données.mdb") Set re = bds.OpenRecordset("SELECT [Dénomination] FROM [Produits] WHERE [Dénomination] LIKE '%" & Textbox1 & "%';") re.MoveFirst n = 0 Do While Not re.EOF ListProd.AddItem re.Fields("Dénomination").Value re.MoveNext n = n + 1 Loop
If Not re Is Nothing Then re.MoveFirst n = 0 Else Message = MsgBox("Il n'y a aucun résultat.", vbExclamation + vbOKOnly, "Résultats") re.Close Exit Sub End If
Dim monRS As ADODB.Recordset Set monRS = New ADODB.Recordset With monRS .CursorLocation = adUseClient .Open "Select * From maTable", , adOpenStatic, adLockReadOnly If .RecordCount > 0 Then .MoveFirst Do While Not .EOF Debug.Print .Fields(0).Name, .Fields(0).Value .MoveNext Loop End If .Close End With
Dim bds As DAO.Database Dim re As DAO.Recordset, re2 As DAO.Recordset Dim champ As Field
Private Sub Rechercher_Click() Dim bds As ADODB.Database Dim monRS As ADODB.Recordset Set bds = OpenDatabase("F:\Users\Romain\Desktop\Management\Base de données.mdb") Set monRS = New ADODB.Recordset With monRS .CursorLocation = adUseClient .Open "Select * From Produits", , adOpenStatic, adLockReadOnly If .RecordCount > 0 Then .MoveFirst Do While Not .EOF Debug.Print .Fields(0).Name, .Fields(0).Value .MoveNext Loop End If .Close End With End Sub
Dim maConnexion As ADODB.Connection Set maConnexion = New ADODB.Connection maConnexion.ConnectionString = _ "Provider=Microsoft.Jet.OLEDB.4.0;" & _ "Persist Security Info=False;" & _ "Data Source=" & "C:\mon répertoire\monFichier.MDB" maConnexion.Open ' Ouvre la connexion.