L
Leo
Here's the code I'm using
Public Function SelectedFunds() As String
Dim LowerVal As Variant
Dim UpperVal As Variant
Dim i As Integer
Dim str1 As String
'Lower Upper boundry
LowerVal = LBound(arrSelectedFunds)
UpperVal = UBound(arrSelectedFunds)
For i = LowerVal To UpperVal
If arrSelectedFunds(i) <> "" Then
If str1 <> "" Then
str1 = str1 & " Or '" & arrSelectedFunds(i) & "'"
Else
str1 = "'" & arrSelectedFunds(i) & "'"
End If
End If
Next
SelectedFunds = str1
End Function
The problem is that the string will *wrap* the string within, in double
quotes, so for example" str1 will look like: "'H61B' Or 'H61C' Or 'H61D'".
This will make the criteria for the query incorrect
Replace is not working. What else can I do??
Thanks a lot
Public Function SelectedFunds() As String
Dim LowerVal As Variant
Dim UpperVal As Variant
Dim i As Integer
Dim str1 As String
'Lower Upper boundry
LowerVal = LBound(arrSelectedFunds)
UpperVal = UBound(arrSelectedFunds)
For i = LowerVal To UpperVal
If arrSelectedFunds(i) <> "" Then
If str1 <> "" Then
str1 = str1 & " Or '" & arrSelectedFunds(i) & "'"
Else
str1 = "'" & arrSelectedFunds(i) & "'"
End If
End If
Next
SelectedFunds = str1
End Function
The problem is that the string will *wrap* the string within, in double
quotes, so for example" str1 will look like: "'H61B' Or 'H61C' Or 'H61D'".
This will make the criteria for the query incorrect
Replace is not working. What else can I do??
Thanks a lot