哪位大佬能帮忙解答,如何将文本字符串tempFieldsTypes转变为DAO.DateTypenum变量组?
Dim FieldType() As DAO.DataTypeEnum
Byval tempFieldsTypes as string
tempFieldsTypes = "dbtext,dbdate,dbtext,dbtext,dbsingle,dblong,dbtext,dbtext,dbdate,dbtext"
问题解决了,我用了比较笨的办法。先分解字符串,再用Selece case转变为字符串为DAO.DateTypeEnum变量。
不知道为什么,Dim FieldType() as DAO.DataTypeEnum 会出错;Dim FieldType(20) as DAO.DataTypeEnum 就可以用了。
'分解字段字符串
Dim TypeString() As String
TypeString() = Split(tempFieldsTypes, ",")
'字段类型字符串变量转换成字段类型DAO字段类型变量
Dim FieldType(20) As DAO.DataTypeEnum
For x = LBound(TypeString) To UBound(TypeString)
Select Case TypeString(x)
Case "dbText"
FieldType(x) = dbText
Case "dbDate"
FieldType(x) = dbDate
Case "dbSingle"
FieldType(x) = dbSingle
Case "dbLong"
FieldType(x) = dbLong
Case Else
MsgBox x & Chr(13) & TypeString(x)
End Select
Next
总记录:1篇 页次:1/1 9 1 :