Link to home
Start Free TrialLog in
Avatar of Victor  Charles
Victor CharlesFlag for United States of America

asked on

Help with partial string search using Substring

Hi,


How do you modify the Substring below which searches for the first three characters in a field to search for part of the data in a data field,

For example if the field contains 9999-00-999-9999 Ho do I search only for 00, considering xyz '''00'".

Dim SearchCriteria as String = "Substring(SN, 1,3) IN ('" & xyz &"')

Thanks,

Victor
ASKER CERTIFIED SOLUTION
Avatar of Nasir Razzaq
Nasir Razzaq
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I think what you are saying is that if you have a field like

9999-00-999-9999

You want to search against the 6-7th characters instead of the 1-3rd characters, right?

Dim SearchCriteria as String = "Substring(SN, 6,2) IN ('" & xyz &"')
Avatar of Victor  Charles

ASKER

Thank You for both answers, I will get back to you.

Victor
Hi,

I was able to solve the issue withthe code below.

Dim SearchCriteria as String = "SN LIKE '%" & xyz &"%'"


Thanks,

Victor
Thank You.