If you want to get the SQL Statement that describes comma seperated value or a range of values or b
If you want to get the SQL Statement that describes comma seperated value or a range of values or both ... Like you want the owners of account
Rate If you want to get the SQL Statement that describes comma seperated value or a range of values or b
(1(1 Vote))
'Khalid Sweeseh ([email protected])
'www.Globitel.com
On Error GoTo ErrH
Dim StringCollection As Collection
Dim strBetweenSQL As String
Dim strBTWNOp As String
Dim strINOp As String
Dim strInSQL
Dim i As Integer
i = 1
i = InStr(i, strIn, ",")
Set StringCollection = New Collection
While i > 0
StringCollection.Add Mid(strIn, 1, i - 1)
strIn = Mid(strIn, i + 1)
i = InStr(1, strIn, ",")
Wend
StringCollection.Add strIn
For i = 1 To StringCollection.Count
If InStr(StringCollection.Item(i), "-") Then
strBetweenSQL = strBetweenSQL & strBTWNOp & "% Between '" & Replace(StringCollection.Item(i), "-", "' And '") & "'"
strBTWNOp = " OR "
Else
strInSQL = strInSQL & strINOp & "'" & StringCollection.Item(i) & "'"
strINOp = ","
End If
Next i
strBetweenSQL = Replace(strBetweenSQL, "%", FieldName)
If Len(strInSQL) Then strInSQL = FieldName & " In (" & strInSQL & ")"
SepStringtoSQL = strBetweenSQL & IIf(Len(strInSQL) > 0 And Len(strBetweenSQL) > 0, " OR ", "") & strInSQL
Exit Function
ErrH:
MsgBox Err.Description
End Function
If you want to get the SQL Statement that describes comma seperated value or a range of values or b Comments
No comments yet — be the first to post one!
Post a Comment