Office中国论坛/Access中国论坛

标题: 【求助】实现拼音首字母查询出现了点问题 [打印本页]

作者: yangruihao    时间: 2011-11-1 15:08
标题: 【求助】实现拼音首字母查询出现了点问题
[attach]47179[/attach]
要实现图片中的查询..
里面有一模块是拼音首字母函数的
Public Function PinYin(Tstr As String) As String

    Dim I As Long
    I = Asc(Tstr)
    If I >= Asc("啊") And I < Asc("芭") Then PinYin = "A"
    If I >= Asc("芭") And I < Asc("擦") Then PinYin = "B"
    If I >= Asc("擦") And I < Asc("搭") Then PinYin = "C"
    If I >= Asc("搭") And I < Asc("蛾") Then PinYin = "D"
    If I >= Asc("蛾") And I < Asc("发") Then PinYin = "E"
    If I >= Asc("发") And I < Asc("噶") Then PinYin = "F"
    If I >= Asc("噶") And I < Asc("哈") Then PinYin = "G"
    If I >= Asc("哈") And I < Asc("击") Then PinYin = "H"
    If I >= Asc("击") And I < Asc("喀") Then PinYin = "J"
    If I >= Asc("喀") And I < Asc("垃") Then PinYin = "K"
    If I >= Asc("垃") And I < Asc("妈") Then PinYin = "L"
    If I >= Asc("妈") And I < Asc("拿") Then PinYin = "M"
    If I >= Asc("拿") And I < Asc("哦") Then PinYin = "N"
    If I >= Asc("哦") And I < Asc("啪") Then PinYin = "O"
    If I >= Asc("啪") And I < Asc("欺") Then PinYin = "P"
    If I >= Asc("欺") And I < Asc("然") Then PinYin = "Q"
    If I >= Asc("然") And I < Asc("撒") Then PinYin = "R"
    If I >= Asc("撒") And I < Asc("塌") Then PinYin = "S"
    If I >= Asc("塌") And I < Asc("挖") Then PinYin = "T"
    If I >= Asc("挖") And I < Asc("昔") Then PinYin = "W"
    If I >= Asc("昔") And I < Asc("压") Then PinYin = "X"
    If I >= Asc("压") And I < Asc("匝") Then PinYin = "Y"
    If I >= Asc("匝") And I <= Asc("座") Then PinYin = "Z"

End Function

Function Getpinyin(str As String) As String

    Dim I As Long
    For I = 1 To Len(str)
        Getpinyin = Getpinyin & PinYin(Mid(str, I, 1))
    Next I
   
End Function

可是我不知道怎样具体去实现,我是个新手,求助各位大侠啊!
[attach]47180[/attach]
作者: yangruihao    时间: 2011-11-1 15:54
不要沉下去,求大虾,跪求高人啊
作者: yanwei82123300    时间: 2011-11-1 16:45
搜索论坛上的例子,同时参考罗斯文的例子!!
作者: yanwei82123300    时间: 2011-11-1 16:47
http://www.office-cn.net/forum.p ... =%C2%DE%CB%B9%CE%C4    参考此例子
作者: yangruihao    时间: 2011-11-1 16:49
yanwei82123300 发表于 2011-11-1 16:45
搜索论坛上的例子,同时参考罗斯文的例子!!

谢谢哈,我看看
作者: yangruihao    时间: 2011-11-1 16:49
yanwei82123300 发表于 2011-11-1 16:47
http://www.office-cn.net/forum.php?mod=viewthread&tid=67243&highlight=%C2%DE%CB%B9%CE%C4    参考此例 ...

恩人呐
作者: yangruihao    时间: 2011-11-1 16:50
yanwei82123300 发表于 2011-11-1 16:45
搜索论坛上的例子,同时参考罗斯文的例子!!

一会看看哈




欢迎光临 Office中国论坛/Access中国论坛 (http://www.office-cn.net/) Powered by Discuz! X3.3