|
8#
楼主 |
发表于 2006-4-29 23:12:00
|
只看该作者
Private Sub Field3_AfterUpdate()
Dim Rs As New ADODB.Recordset
Dim Sql As String
'清空组合框
If Me.Field4.ListCount > 0 Then
For i = 0 To Me.Field4.ListCount - 1
Me.Field4.RemoveItem (i)
Next
Else
End If
'添加ITEM
' Sql = "select * from table1 where [like]= '" & Me.Field3 & "'"
Sql = "select * from table1 where [like] like '" & Me.Field3 & "'"
Rs.Open Sql, CurrentProject.Connection, adOpenDynamic, adLockOptimistic
i = 0
Do While Not Rs.EOF
i = i + 1
Rs.MoveNext
Loop
If i > 0 Then
Rs.MoveFirst
Do While Not Rs.EOF
Me.Field4.AddItem Rs.Fields("THIS")
Rs.MoveNext
Loop
Set Rs = Nothing
Else
Me.Field4.AddItem "Blank"
End If
' 选择第一个item
Me.Field4 = Me.Field4.ItemData(0)
Me.Field4.Requery
End Sub
非常好,在下慢慢领会!!!谢谢 |
|