会计考友 发表于 2012-7-31 22:26:35

如何解决组合框无法满足大量数据的选择问题(2)

如何解决组合框无法满足大量数据的选择问题(2)
Private Sub List0_DblClick(Cancel As Integer)
  checkYouSelect
  End Sub
  Private Sub List0_KeyPress(KeyAscii As Integer)
  '本过程实现全键盘操作
  If KeyAscii = 13 Then
  checkYouSelect
  End If
  End Sub
  Sub closeAllSelectForm(strFormName As String)
  '通用过程1
  '本过程用来关闭所有的指定名称的窗体
  For Each objForm In Forms
  If objForm.Name = strFormName Then
  DoCmd.Close acForm, objForm.Name
  End If
  Next objForm
  End Sub
  Sub checkYouSelect()
  '通用过程2
  '检测你的选择
  '如果发现 suncount 列为 0(表示没有下一层了)
  '就可以把你选定的产品名称放到文本框中了
  On Error Resume Next
  Set f = New Form_SelectForm
  Dim objForm As Form
  If List0.Column(0) = 0 Then
  Forms("testform").Text0.Value = List0.Column(2)
  closeAllSelectForm "SelectForm"
  Else
  f.Visible = True
  f.List0.RowSource = "SELECT btype.soncount, btype.UserCode, btype.FullName, btype.typeId FROM btype WHERE parid='" & List0.Value & "'"
  End If
  End Sub
页: [1]
查看完整版本: 如何解决组合框无法满足大量数据的选择问题(2)