for i = grid.fixedcols to grid.cols-1 if isnumeric(grid.textmatrix(grid.fixedrows,i)) then msgbox "数字" elseif isdate(grid.textmatrix(grid.fixedrows,i)) then msgbox "日期" else msgbox "字符" end if next
放到grid里面数据都被转换成字符型,要想判断什么类型 看看绑定的rs相关类型 MsgBox FieldType(rs("SomeDate").Type)Public Function FieldType(intType As Integer) As String Select Case intType Case adChar FieldType = "adChar" Case adVarChar FieldType = "adVarChar" Case adSmallInt FieldType = "adSmallInt" Case adUnsignedTinyInt FieldType = "adUnsignedTinyInt" Case adDBTimeStamp FieldType = "adDBTimeStamp" End SelectEnd Function
isnumber
isdate
……
if isnumeric(grid.textmatrix(grid.fixedrows,i)) then
msgbox "数字"
elseif isdate(grid.textmatrix(grid.fixedrows,i)) then
msgbox "日期"
else
msgbox "字符"
end if
next
看看绑定的rs相关类型
MsgBox FieldType(rs("SomeDate").Type)Public Function FieldType(intType As Integer) As String Select Case intType
Case adChar
FieldType = "adChar"
Case adVarChar
FieldType = "adVarChar"
Case adSmallInt
FieldType = "adSmallInt"
Case adUnsignedTinyInt
FieldType = "adUnsignedTinyInt"
Case adDBTimeStamp
FieldType = "adDBTimeStamp"
End SelectEnd Function