text1.text='abcdef/dddf/sefs',如何分別取得abcdef,dddf,sefs.誰手頭有相關函數
這個條件我是打算用於要SQL中select * from test where '" & tmp & "'tmp是變量:test01='條件1' or test01='條件2' test01='條件3'
條件1=abcdef
條件2=dddf
條件3=sefs
.
.
.
大家手上有沒有類似函數?請幫幫忙!
謝謝!

解决方案 »

  1.   


    Split Function
          DescriptionReturns a zero-based, one-dimensional array containing a specified number of substrings.SyntaxSplit(expression[, delimiter[, limit[, compare]]])The Split function syntax has these named arguments:Part Description 
    expression Required. String expression containing substrings and delimiters. If expression is a zero-length string(""), Split returns an empty array, that is, an array with no elements and no data. 
    delimiter Optional. String character used to identify substring limits. If omitted, the space character (" ") is assumed to be the delimiter. If delimiter is a zero-length string, a single-element array containing the entire expression string is returned. 
    limit Optional. Number of substrings to be returned; –1 indicates that all substrings are returned. 
    compare Optional. Numeric value indicating the kind of comparison to use when evaluating substrings. See Settings section for values. 
    SettingsThe compare argument can have the following values:Constant Value Description 
    vbUseCompareOption –1 Performs a comparison using the setting of the Option Compare statement. 
    vbBinaryCompare 0 Performs a binary comparison. 
    vbTextCompare 1 Performs a textual comparison. 
    vbDatabaseCompare 2 Microsoft Access only. Performs a comparison based on information in your database. 
      

  2.   

    dim lsArr() as string 
    lsarr = split(text1.text,"/")
    debug.print lsArr(0)
    debug.print lsArr(1)
    debug.print lsArr(2)
      

  3.   

    以上两位大虾说得是很对:
        用INSTR函数和mid函数即可解决问题
        但也可用INSTR函数及LEFT()及RIGHT()函数
        方法如下:  件1=left(text1.text,INSTR(text1.text,"/")-1)
       lsStr=right(text1.text,len(text1.text)-INSTR(text1.text,"/"))
    條件2=left(lsStr,INSTR(lsStr,"/")-1)
    條件3=right(lsStr,len(lsStr)-INSTR(lsStr,"/"))
      

  4.   

    用split函数!
    dim a() as string
    a=split(text1.text,"/")
      

  5.   

    还有for i=0 to ubound(a)
         debug.print a(i)
    next
      

  6.   

    dim lsArr() as string 
    lsarr = split(text1.text,"/")
    debug.print lsArr(0)
    debug.print lsArr(1)
    debug.print lsArr(2)