Access如何引用文本框中的信息来查询表格,并从另一个文本框显示出来?代码怎么写? 5

如图,现有一张表格“汉字表”和一个窗体“输入文字”。目标:在窗体文本框中键盘输入任意词语或文字(字数2—3字),点击“开始释义”按钮,于是程序自动在下面把输入文字分成单字... 如图,现有一张表格“汉字表”和一个窗体“输入文字”。目标:在窗体文本框中键盘输入任意词语或文字(字数2—3字),点击“开始释义”按钮,于是程序自动在下面把输入文字分成单字显示,并根据表格显示各字释义。如何设置?代码怎么写? 展开
 我来答
lp...z@163.com
2017-11-18 · 超过23用户采纳过TA的回答
知道答主
回答量:53
采纳率:71%
帮助的人:4.8万
展开全部
Public Function SumInWordsRMB _
(SumInFigures As Variant, Optional WithoutHeadRMB As Boolean) As String
Dim a As Double, b As Byte
Dim Str As String, Strg As String
Dim strInteger As String
Dim strInt As String
Dim strDecimal
Dim strDecml
Dim Char As String
Dim DigtWord As String
Dim Pos As Byte
Dim i As Byte, Lns As Byte, ii
Dim canAddZero As Boolean
Dim AddZero As Boolean
Dim UseFullDigtWord As Boolean
If Not IsNumeric(SumInFigures) Then
SumInWordsRMB = ""
Exit Function
Else
a = CDbl(SumInFigures)
If a 0 Or a > 999999999999999# Then
SumInWordsRMB = ""
Exit Function
End If
End If
Pos = 0
Strg = CStr(SumInFigures)
For ii = 1 To Len(Strg)
Char = Mid(Strg, ii, 1)
If Char = "." Then
Pos = ii
If IsMissing(Str) Then Str = "0"
Exit For
End If
If Char = "0" Then
If AddZero = True Then Str = Str & Char
Else
Str = Str & Char
AddZero = True
End If
Next ii
If Pos > 0 And Mid(Strg, Pos + 1, 3) > "" Then
a = 0
b = 0
If Val(Mid(Strg, Pos + 3, 1)) >= 5 Then b = 1
b = b + Val(Mid(Strg, Pos + 2, 1))
b = 100 + Val(Mid(Strg, Pos + 1, 1)) * 10 + b
If b >= 200 Then
a = Str
a = a + 1
Str = a
End If
If b > 0 Then
If Val(Right(b, 1)) > 0 Then
Str = Str & "." & Mid(b, 2)
Else
If Val(Mid(b, 2, 1)) > 0 Then Str = Str & "." & Mid(b, 2, 1)
End If
End If
End If
AddZero = False
If Str = "0" Or Str = "" Then
If WithoutHeadRMB Then
SumInWordsRMB = "零元整"
Else
SumInWordsRMB = "人民币零元整"
End If
Exit Function
End If
Strg = ""
For i = 1 To Len(Str)
Select Case Mid(Str, i, 1)
Case "0"
Strg = Strg & "零"
Case "1"
Strg = Strg & "壹"
Case "2"
Strg = Strg & "贰"
Case "3"
Strg = Strg & "叁"
Case "4"
Strg = Strg & "肆"
Case "5"
Strg = Strg & "伍"
Case "6"
Strg = Strg & "陆"
Case "7"
Strg = Strg & "柒"
Case "8"
Strg = Strg & "捌"
Case "9"
Strg = Strg & "玖"
Case "."
Strg = Strg & "."
End Select
Next i
Pos = 0
Pos = InStr(1, Strg, ".", vbTextCompare)
If Pos > 0 Then
strInteger = Left(Strg, Pos - 1)
strDecimal = Mid(Strg, Pos + 1)
Else
strInteger = Strg
End If
If strInteger = "零" Then
strInt = ""
Else
strInteger = StrReverse(strInteger)
Lns = Len(strInteger)
For i = 1 To Lns
Select Case i
Case 1
DigtWord = "元"
Case 2
DigtWord = "拾"
Case 3
DigtWord = "佰"
Case 4
DigtWord = "仟"
Case 5
DigtWord = "万"
Case 6
DigtWord = "拾万"
Case 7
DigtWord = "佰万"
Case 8
DigtWord = "仟万"
Case 9
DigtWord = "亿"
Case 10
DigtWord = "拾亿"
Case 11
DigtWord = "佰亿"
Case 12
DigtWord = "仟亿"
Case 13
DigtWord = "万亿"
Case 14
DigtWord = "拾万亿"
Case 15
DigtWord = "佰万亿"
End Select
Char = Mid(strInteger, i, 1)
If Char = "零" Then
If i = 1 Then strInt = "元"
UseFullDigtWord = True
If canAddZero = True Then AddZero = True
Else
If UseFullDigtWord = True Then
If AddZero = False Then
strInt = Char & DigtWord & strInt
Else
If i >= 6 And i <= 8 Then
If Mid(strInteger, 5, 1) > "零" Then
strInt = Char & Left(DigtWord, 1) & "零" & strInt
Else
strInt = Char & DigtWord & "零" & strInt
End If
ElseIf i >= 10 And i <= 12 Then
If Mid(strInteger, 9, 1) > "零" Then
strInt = Char & Left(DigtWord, 1) & "零" & strInt
Else
strInt = Char & DigtWord & "零" & strInt
End If
ElseIf i >= 14 And i <= 15 Then
If Mid(strInteger, 13, 1) > "零" Then
strInt = Char & Left(DigtWord, 1) & "零" & strInt
Else
strInt = Char & DigtWord & "零" & strInt
End If
Else
strInt = Char & DigtWord & "零" & strInt
End If
End If
Else
If AddZero = False Then
strInt = Char & Left(DigtWord, 1) & strInt
Else
strInt = Char & Left(DigtWord, 1) & "零" & strInt
End If
End If
canAddZero = True
UseFullDigtWord = False
AddZero = False
End If
Next i
End If
If Pos = 0 Then strDecml = "整"
If Pos > 0 Then
If Len(strDecimal) = 1 Then strDecml = strDecimal & "角整"
If Len(strDecimal) = 2 Then
If Left(strDecimal, 1) = "零" Then
If strInt = "" Then
strDecml = Right(strDecimal, 1) & "分"
Else
strDecml = "零" & Right(strDecimal, 1) & "分"
End If
Else
strDecml = Left(strDecimal, 1) & "角"
strDecml = strDecml & Right(strDecimal, 1) & "分"
End If
End If
End If
If WithoutHeadRMB = False Then
strInt = "人民币" & strInt
End If
SumInWordsRMB = strInt & strDecml
End Function
本回答被网友采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
grace23450
2017-11-17 · TA获得超过1.3万个赞
知道大有可为答主
回答量:7081
采纳率:77%
帮助的人:2334万
展开全部
做一个模糊查询,你不会吗?
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 1条折叠回答
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式