|
Private Sub 半角替换全角_Click()
Call QJ2BJ("表1", "结果")
Call QJ2BJ("表2", "结果")
End Sub
Sub QJ2BJ(StrTableName As String, StrFildName As String)
Dim Rs As New ADODB.Recordset
Dim Conn As New ADODB.Connection
Dim Str As String
Set Conn = CurrentProject.Connection
Rs.Open "select * from " & StrTableName & "", Conn, adOpenDynamic, adLockOptimistic
Do While Not Rs.EOF
Str = Rs.Fields("" & StrFildName & "")
Str = StrConv(Str, vbWide) ' 为防止全角半角的混合输入,统一转换为全角
Str = Replace(Str, "。", ".")
Str = Replace(Str, ".", ".")
Str = StrConv(Str, vbNarrow)
Rs.Fields("" & StrFildName & "") = Str
Rs.Update
Rs.MoveNext
Loop
Rs.Close
Set Rs = Nothing
Set Conn = Nothing
End Sub |
|