473,394 Members | 1,902 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Find values in string

Hi all,

I've a Microsoft Access query problem that need help.

let's say the string value in the field as following:-

1111
1010
1234

I wanted to write a query to return any records that have the value of "1" that occur 2 times in the string value.

The result should be:-

1111
1010


Another scenario:-

let's say the string value in the field as following:-

1234
4321
1123
1210

I wanted to write a query to return any records that have the value of "1", "2", and "3" that all 3 values should occur in the string value.

The result should be:-

1234
4321
1123

I've tried "instr" or "like" but it doesn't work. Please help.


Thanks in advanced.
Aug 1 '10 #1
2 1651
missinglinq
3,532 Expert 2GB
In the Query Grid create a calculated field to count the Ones:

Expand|Select|Wrap|Line Numbers
  1. CountOnes: Len([Target])-Len(Replace([Target],"1",""))
and pull only records (using the field's Criteria) where there are two of them:

Criteria: = 2

Similarly, to pull records with a 1 and a 2 and a 3, create three calculated fields to count the Ones, Twos and Threes

Expand|Select|Wrap|Line Numbers
  1. CountOnes: Len([Target])-Len(Replace([Target],"1",""))
Expand|Select|Wrap|Line Numbers
  1. CountTwos: Len([Target])-Len(Replace([Target],"2",""))
Expand|Select|Wrap|Line Numbers
  1. CountThrees: Len([Target])-Len(Replace([Target],"3",""))
and pull only records (using each field's Criteria) where there are at least one each of Ones, Twos, and Threes

Criteria > 0 (for the Criteria in each calculated field)

Welcome to Bytes!

We needed one more insane member here!

Linq ;0)>
Aug 1 '10 #2
Hi missinglinq,

Thanks for the reply, but I would like to access the query via Visual Basic 6 application but hit error "undefined function 'replace' in expression"

May I know if there is any workaround?
Aug 2 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Phil | last post by:
hello I am a trying to find the text between a ? mark and an = sign: var theData; var begin; var thePageNo; var beginFrom; beginFrom = top.location.href.indexOf("="); begin =...
6
by: Jozef Jarosciak | last post by:
Quickest way to find the string in 1 dimensional string array! I have a queue 1 dimensional array of strings called 'queue' and I need a fast way to search it. Once there is match, I don't need...
10
by: Federico G. Babelis | last post by:
Hi, I need to extract a string from another string separated by "," like a .csv file. for example I have this string: String1 = 000,federico,00,439827HGH,1233,FGB,0000,00,000 and from that...
2
by: Robin Tucker | last post by:
Hiya, Regular expressions always do my gnads in - can anyone cook up a reg expression to find all string literals in my code? I would like to put them into a resource file for future...
2
by: Gaijinco | last post by:
I was trying a function that read an string (which previously had attached two special characters & for the beginning of the word and # for the end of the word) and if it was "<word>ize" it changed...
0
by: 29kat | last post by:
I need to find one specific string which is available in the excel sheet from Visual Basic and I want to get the details or values related to that specified string in excel from VB.
3
by: Austin Varghese | last post by:
How can i find a string from a file and hilight it? somebody pls help me
1
by: sai14 | last post by:
Hi all, i would like to know if it is possible find particular string in a text file using vc++? please do let me know how to write the syntax Thanks
2
by: Pradeep Arkasali | last post by:
directory is /v_dialer in that i have to find the string v_dialer in all the files as well as subdirectories, here for some of the files i don't have ownership,how can i use ownership in this...
5
by: neeludhiman | last post by:
Hi All, Can someone please help me with the code in C / C++ to find a string in an input text file and replace it with another string in output text file. The catch is that white spaces in the...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.