Option Explicit Dim Cnx As ADODB.Connection Dim Cmd1 As ADODB.Command Dim MonRs As ADODB.Recordset Dim CheminFichier As String Dim MotDePasse As String Public Sub ConnexionBase() Set Cnx = New ADODB.Connection With Cnx .Provider = "Microsoft.Jet.OLEDB.4.0;" .ConnectionTimeout = 30 .Mode = adModeShareExclusive .Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & CheminFichier & ";Persist Security Info=False;Jet OLEDB:Database Password=" & MotDePasse End With End Sub Private Sub Form_Load() CheminFichier = App.path & "\article.mdb" MotDePasse = "informatique" ConnexionBase RemplirListArticles End Sub Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer) Cnx.Close End Sub Private Sub RemplirListArticles(Optional ByRef vsLibelle As String) g.Rows = 1 Set MonRs = Cnx.Execute("SELECT * From article", , adCmdText) MonRs.MoveFirst Do While Not MonRs.EOF g.AddItem MonRs("code_art").Value g.Row = g.Rows - 1 g.Col 1: g.Text MonRs("LIbelle").Value MonRs.MoveNext Loop MonRs.Close End Sub
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionOption Explicit 'Private Base As Database Public cnx As New ADODB.Connection Private dbPassWord As String Private URL_BASE As String Public Sub ConnexionBase() Dim ChaineConnexion As String URL_BASE = App.path & "\article.mdb" 'Ou 'URL_BASE = "c:\commerce\article.mdb" dbPassWord = "informatique" ChaineConnexion = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & URL_BASE & ";Persist Security Info=False;" ChaineConnexion = ChaineConnexion & "Jet OLEDB:Database Password=" & dbPassWord cnx.Open ChaineConnexion End Sub Private Sub Form_Load() ConnexionBase 'Set Base = OpenDatabase("c:\commerce\article.mdb") 'RemplirListArticles End Sub
système donnée errer ici -----> Public cnx As New
j'ai besoin d'une solution consiste "CRYSTAL REPORTS 4.6.1.0"ouvre une autre discussion (je ne connais pas)
Private Sub Text2_Change() Dim i As Long Dim Trouvé As Boolean Trouvé = False For i = 1 To g.Rows - 1 g.Col 0: g.Row i If InStr(1, LCase(g.Text), LCase(Text2.Text)) > 0 Then Trouvé = True g.Col 1: g.Row i If InStr(1, LCase(g.Text), LCase(Text2.Text)) > 0 Then Trouvé = True If Trouvé = True Then g.RowSel = i g.ColSel = 0 Exit For End If Next End Sub