[RESOLVED] Getting the value of the given strings
Hello everyone, I have a problem regarding getting the value of the string. For example I have '345' on my string and on my database I have field of tables that the strings are divisible by 3 like for example 934526345789 and it was stored on my msaccess database. My problem is that I am comparing the strings i have, if it is existing or not but my problem is that on the database field it should be chunk 3 by 3. Like the example I have, it is 934,526,345,789 so only 1 number of 345 is there. But if you observed there is another 345 there but chunk therefore it is not the strings same as what i have on my strings. So if in the database there is 934526, the string that i have that was '345' is not existing to that value because it is 934,526. Could anybody help me to solve this? The query or the syntax on how to get that. Thanks in advance.
Re: Getting the value of the given strings
I presume you are currently using a Like query with % (or *) wildcards to match any amount of characters, in which case just change it to _ (or ?) to indicate a single character, eg:
..and use multiple copies of that, one for each possible length.
If you have problems getting it working, show us the code (as you should have done before) and tell us the issue(s).
Re: Getting the value of the given strings
thank for the response si_the_geek.. this is my query..
vb Code:
CSClass = '123'
strSQL = "SELECT ClassificationCode, ClassCode FROM Classification WHERE ClassificationCode LIKE '" & CSClass.ToString() & "%'"
My problem to this is that it will just return any series number that contains '123' but that's not what i want. Since the ClassificationCode contained numbers that are divisible by 3, I want to compare it 3 by 3. Like for example '234341235', this number will still display on my grid even i don't want to because If it will chunk it, it will be 234,341,235 so there's no '123' on it.
Re: Getting the value of the given strings
Is there a reason that you haven't tried my suggestion?
Re: Getting the value of the given strings
Thanks again si_the_geek.
it won't work. Maybe i misunderstand for what you have suggested.
What i did is '%" & CSClass.ToString() & "_'" instead of '" & CSClass.ToString() & "%'
Quote:
and use multiple copies of that, one for each possible length
What did you mean by this? How to do that?
Re: Getting the value of the given strings
Quote:
Originally Posted by
shyguyjeff
What i did is '%" & CSClass.ToString() & "_'"
That will match values which have any characters (%), followed by your string, followed by any single character (_).
To have it followed by any 3 characters, you need 3 _ wildcards as I showed.
Quote:
What did you mean by this? How to do that?
Use multiple Like conditions (one for 3 characters after, one for 6 characters after, ...), joined by OR's.
Re: Getting the value of the given strings
ahhh i see..now i got the point...I will try to do that and i will come back later after resolving this problem. Thanks si_the_geek. Have a nice day. :)