Function CData(ByVal strWord, ByVal intType)
On Error Resume Next
Select Case intType
Case 0
CData = 0
If IsNumeric(strWord) Then If strWord Then CData = 1
Case 1
CData = 0
If IsNumeric(strWord) Then CData = CInt(CByte(strWord))
Case 2
CData = 0
If IsNumeric(strWord) Then CData = CInt(strWord)
Case 3
CData = 0
If IsNumeric(strWord) Then CData = CLng(strWord)
Case 4
CData = 0
If IsNumeric(strWord) Then CData = CCur(strWord)
Case 5
CData = Now()
If IsDate(strWord) Then CData = strWord
Case 6
CData = “”
If strWord > “” Then CData = Replace(Replace(strWord, CHR(0), “”), “‘”, “””)
Case 7
If strWord > “” Then
strWord = Replace(strWord, CHR(0), “”)
strWord = Replace(strWord, “‘”, “””)
strWord = Replace(strWord, “[“, “[[]”) 软件开发网 bbs.mscto.com
strWord = Replace(strWord, “%”, “[%]”)
CData = Replace(strWord, “_”, “[_]”)
Else
CData = “”
End If
Case Else
CData = “”
If strWord > “” Then CData = CStr(strWord)
End Select
On Error Goto 0
End Function
Leave A Comment