Author Topic: Selection Set Filter Question  (Read 3073 times)

0 Members and 1 Guest are viewing this topic.

fxcastil

  • Guest
Selection Set Filter Question
« on: March 03, 2013, 03:24:11 PM »
I can create a selection set filter to give me text with words ABC* and HJK* using the following

ReDim intFltrCode(1) As Integer
ReDim varFltrVal(1) As Variant

intFltrCode(0) = 0: varFltrVal(0) = "TEXT"
intFltrCode(1) = 1: varFltrVal(1) = "ABC*, HJK*"     ' this line works

*************************************************

But now I want to use a string variable instead of ABC* and HJK*

strVariable1 = "ABC*"
strVariable2 = "HJK*"

ReDim intFltrCode(1) As Integer
ReDim varFltrVal(1) As Variant

intFltrCode(0) = 0: varFltrVal(0) = "TEXT"
intFltrCode(1) = 1: varFltrVal(1) = strVariable1, strVariable2   ' This Line does NOT work


********************************************

I also tried this and it does not work

Dim MyArray (1 to 2) as String

myArray(1) = "ABC*"
myArray(2) = "HJK*"


ReDim intFltrCode(1) As Integer
ReDim varFltrVal(1) As Variant

intFltrCode(0) = 0: varFltrVal(0) = "TEXT"
intFltrCode(1) = 1: varFltrVal(1) = myArray   ' This Line does NOT work

****************************

If I only use one variable to define Text contents or single word this works

strVariable1 = "ABC*"

ReDim intFltrCode(1) As Integer
ReDim varFltrVal(1) As Variant

intFltrCode(0) = 0: varFltrVal(0) = "TEXT"
intFltrCode(1) = 1: varFltrVal(1) = strVariable1 '  This Line does work but I want to use an OR condition of multiple words






Jeff_M

  • King Gator
  • Posts: 4094
  • C3D user & customizer
Re: Selection Set Filter Question
« Reply #1 on: March 03, 2013, 05:54:07 PM »
It's been a long time since I used VBA so not sure if this is exactly how strings are concatenated. But essentially, as you found, it must be a single string so just add all the elements together.

intFltrCode(1) = 1: varFltrVal(1) = strVariable1 & "," & strVariable2

fxcastil

  • Guest
Re: Selection Set Filter Question
« Reply #2 on: March 04, 2013, 02:47:12 AM »
Thanks, I knew I was just missing someting simple and obvious..........