支持拼音首字母的组合框函数及实例提高选择和录入速度
时 间:2007-10-27 12:20:52
作 者:竹笛 ID:8 城市:上海 QQ:2851379730
摘 要:支持拼音首字母的组合框函数及实例提高选择和录入速度
正 文:
支持拼音首字母的组合框函数及实例(非常实用,能大大提高选择和录入速度) Public Function ComboBoxKeyPress(KeyAscii As Integer) As String '调用方法 在组合框的keypress方法中加入: '-------------------------------------------- ' If ComboBoxKeyPress(KeyAscii) <> "" Then KeyAscii = 0 '-------------------------------------------- On Error GoTo Err Dim i As Integer With Screen.ActiveControl If .ControlType = acComboBox And (KeyAscii >= Asc("a") And KeyAscii <= Asc("z")) Then '只能由组合框输入小写字母时调用 ComboBoxKeyPress = Nz(HZPY(Left(.Text, .SelStart))) & Chr(KeyAscii) While HZPY(Left(.ItemData(i), .SelStart + 1)) <> ComboBoxKeyPress And i < .ListCount - 1 i = i + 1 Wend If i <> .ListCount And Mid(.ItemData(i), .SelStart + 1, 1) <> Chr(KeyAscii) Then ComboBoxKeyPress = Left(.ItemData(i), .SelStart + 1) .Value = Null SendKeys ComboBoxKeyPress Else ComboBoxKeyPress = "" '为英文时不代换,否则会进入死循环 End If End If End With Exit Function Err: ComboBoxKeyPress = "" End Function Function HZPY(hzstr As String) As String Dim p0 As String, C As String, str As String Dim i As Integer, j As Integer p0 = "吖八嚓咑妸发旮铪讥讥咔垃呣拿讴趴七呥仨他哇哇哇夕丫匝咗" For i = 1 To Len(hzstr) C = "z" str = Mid(hzstr, i, 1) If Asc(str) > 0 Then C = str Else For j = 1 To 26 If Mid(p0, j, 1) > str Then C = Chr(95 + j) Exit For End If Next End If HZPY = HZPY + C Next End Function
附 件:
演 示:
Access软件网QQ交流群 (群号:54525238) Access源码网店
常见问答:
技术分类:
源码示例
- 【源码QQ群号19834647...(12.17)
- 通过命令按钮让Access列表...(04.24)
- 统计当月之前(不含当月)的记录...(03.11)
- 【Access Inputbo...(03.03)
- 按回车键后光标移动到下一条记录...(02.12)
- 【Access Dsum示例】...(02.07)
- Access对子窗体的数据进行...(02.05)
- 【Access高效办公】上月累...(01.09)
- 【Access高效办公】上月累...(01.06)
- 【Access Inputbo...(12.23)

学习心得
最新文章
- 仓库管理实战课程(15)-月度库存...(04.30)
- Access选择打印机、横纵向、纸...(04.29)
- 仓库管理实战课程(14)-出库功能...(04.26)
- 通过命令按钮让Access列表框指...(04.24)
- 仓库管理实战课程(13)-入库功能...(04.21)
- Access控件美化之--美化按钮...(04.19)
- Access多行文本按指定字符筛选...(04.18)
- Microsoft Access数...(04.18)
- 仓库管理实战课程(12)-月度结存...(04.16)
- 仓库管理实战课程(11)-人性化操...(04.15)