selecting a field where the count of quotes characters is an odd number

J

John Reid

g'day,

i am wondering if it is possible to have a query/expression that selects
only those fields where the number of quotes characters in the field is an
odd number:

ie. would return records 1,4,5,6,7

No. Narrative

1 "hello world" hello world"
2 "hello world"
3 hello world
4 "hello world" "hello world
5 hello world""hello world""hello world"
6 "hello world
7 "hello world""hello world""hello world""hello world"hello world"

salud

John Reid
 
J

John Reid

Yep, rather than attempt a query it looks to me that it easier to export

the table to a txt file and then run some javascript over it.

Salud

John
 
J

John Spencer (MVP)

Seems as if you would have to write a little function to do that

UNTESTED AIRCODE follows:

Public Function fCountQuotesEven(strIn) as Boolean
Dim intLen as Integer
Dim intCount as Integer
Dim intLoop as Integer

If Len(strIn & "") = 0 then
fCountQuotesEven = False
Else
intLen=Len(strIn)
For intLoop = 1 to intLen
If Mid(strIn,1) = Chr(34) then
intCount = intCount +1
End If
Next intLoop
fCountQuotesEven = (((intCount + 1) Mod 2) = 1)
End If

End Function
 
J

John Reid

thanx John, that worked, i made a small change, ie

If Mid(strIn, intLoop, 1) = Chr(34) Then

being a vb novice (well not even that) i did not understand the line

fCountQuotesEven = (((intCount + 1) Mod 2) = 1)
ie why intCount is incremented by 1 before doing the Mod

i am guessing that intCount is either initially set to 1 or the loop runs
thru again. The latter i don't see

salud

John
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top