vb

  M = 0
  Do While Not RecM.EOF    '取内容
    tmpData(M, 0) = M + 1
    tmpData(M, 1) = Choose(RecM!ChkIndex, "电压", "电流", "有功功率", "无功功率", "功率因数", "零序电流")
    tmpData(M, 2) = RecM!ChkPName
    tmpData(M, 3) = GetDCData(RecM!ErrS)
    M = M + 1
    RecM.MoveNext
  Loop
求教:GetDCData函数该怎么写数据库表第三列某一单元格数据如下:
U:-0.09,0.00,-0.05,132.2,132,132.1,132.0,132.0,132.0
取前三个数据,保存为A:-0.99,B:0.00,C:-0.05

解决方案 »

  1.   

    第三列是 ErrS?GetDCData 处理规则都是这样吗?Public Function GetDCData(byVal strSource) As String
    Dim tmp() As String
    Dim strResult As StringOn Error Goto EHIf Left(strSource, 2) <> "U:" Then Exit Functiontmp = Split(Mid(strSource, 3), ",")If Ubound(tmp) >= 0 Then strResult = "A:" & tmp(0)
    If Ubound(tmp) >= 1 Then strResult = strResult & ",B:" & tmp(1)
    If Ubound(tmp) >= 2 Then strResult = strResult & ",C:" & tmp(2)EH:
    GetDCData = strResult
    End Function