|
楼主 |
发表于 2023-4-28 21:25
|
显示全部楼层
Private Sub TextBox1_Change() Dim sqlst As String Dim arr Dim adrs As Object Set adconn = CreateObject("adodb.connection") Set adrs = CreateObject("adodb.recordset") adconn.Provider = "microsoft.ace.oledb.12.0" adconn.Open "D:\360安全浏览器下载\database1.accdb" If adrs.State = 1 Then adrs.Close sqlst = "select * from sheet1 where 简码 like '%" & Me.TextBox1.Value & "%'" adrs.Open sqlst, adconn, 1 If adrs.BOF And adrs.EOF Then Me.ListBox1.Clear Else arr = Application.Transpose(adrs.GetRows) Me.ListBox1.List = arr Me.ListBox1.ColumnCount = 13 Me.ListBox1.ColumnWidths = "50,60,80,40,30,80,80,50,50,50,50,50,50" End If End Sub |
|