2010/03/10

連続絞り込み

Private Sub Form_Load()
Dim rs As New ADODB.Recordset
Dim cn As New ADODB.Connection

Set cn = Application.CurrentProject.Connection
rs.CursorLocation = adUseClient
rs.Open "SQLstring", cn
Set Me.listbox0.Recordset = rs
rs.Close:cn.Close
Set rs = Nothing
Set cn = Nothing
End Sub

Private Sub textbox0_Change()
Dim rs As New ADODB.Recordset
Set rs = Me.listbox0.Recordset
rs.Filter = "F1 like """ & Me.textbox0.Text & "*"""
Set Me.listbox0.Recordset = rs
Set rs = Nothing
End Sub

Private Sub textbox0_GotFocus()
Me.listbox0.Visible = True
End Sub

Private Sub textbox0_LostFocus()
Me.listbox0.Visible = False
End Sub 

0 件のコメント: