I'm trying to write a function, originally to help someone in the JetSQL forum, but am having trouble due to my lack of skill with VB.
My goal is to loop through an array of strings and parse them out of the original string. Here is what I'm working with as of now:
I am getting a Datatype mismatch error on the Replace()function - I understand that the Replace() function wants string data types, but the ParamArray argument in my function can only be variant. Any ideas? Am I even approching this the correct way?
(Sample desired result in Immediate Window)
___
varTemp = "105A/B/C2026/B/-25"
?SerialParse(varTemp, "A/B/C", "/B")
1052026/-25
___
~Melagan
______
"It's never too late to become what you might have been.
My goal is to loop through an array of strings and parse them out of the original string. Here is what I'm working with as of now:
Code:
Public Function SerialParse(ByVal myField As String, ParamArray myArgs() As Variant)
Dim newValue As String
Dim x As Integer
For Each x In myArgs
newValue = Replace(myField, myArgs, "")
Exit For
Next x
End Function
I am getting a Datatype mismatch error on the Replace()function - I understand that the Replace() function wants string data types, but the ParamArray argument in my function can only be variant. Any ideas? Am I even approching this the correct way?
(Sample desired result in Immediate Window)
___
varTemp = "105A/B/C2026/B/-25"
?SerialParse(varTemp, "A/B/C", "/B")
1052026/-25
___
~Melagan
______
"It's never too late to become what you might have been.