Solved string containing character operators

cpampas

Registered User.
Local time
Yesterday, 20:48
Joined
Jul 23, 2012
Messages
221
Hello,
I am struggling with asigning this text to the dafault value of a text box

Spain" > "Primera División 2019/2020

the result is a True False instead of the string, so I tryed in the inmediate window :

Code:
?""Spain" > "Primera División 2019/2020""
 >  0,99950495049505 

?"""Spain" > "Primera División 2019/2020"""
False
still not the desired result. any thoughts ?
 
Hmm. I'm intrigued to know where that number value comes from. May do some investigating.
Would either of these be acceptable?

Code:
?"Spain> Primera Division 2019/2020"
Spain> Primera Division 2019/2020

Or

Code:
?"'Spain'> 'Primera Division 2019/2020'"
'Spain'> 'Primera Division 2019/2020'
 
?2019/2020
0.99950495049505

Do you need those two quote marks in the string?
Code:
?"Spain"" > ""Primera Division 2019/2020"
Spain" > "Primera Division 2019/2020
 
as an addition to this interesting thread, I put the following into the default value property of a textbox:
Code:
="Spain > Primera División 2019/2020"
and in form view, the textbox returned:
Code:
Spain > Primera División 2019/2020
 
Just as a side comment that might or might not help understanding here...

When you put quotes around something, you are telling Access it is a complete thing in and of itself, regardless of what is inside the quotes.

HOWEVER, when you pass a quoted string to something else, the rules of argument passage will sometimes strip out a layer of quotes. Which is why you have to start doing things like """X""" in order to pass "X" (with the quotes) as part of the process.

One solution is to use the apostrophe inside the double quote if that is going to be acceptable, as "'X'" and, particularly in SQL queries, that works. You have to be careful where VBA is involved since apostrophe is a comment marker. (Haven't forgiven whoever made that choice, by the way...)

The other solution is to pass the string in a way that allows the standard quote-stripping process to work - but using symbol concatenation, you pass it right back into something that has quotes around it; i.e. re-assert the quoted nature of the thing being passed after the passage.

Which one you use depends on where and how you want to use it.
 
I understand that the issue here is with these quotes ">", Eventhough I was experimenting with the default value of a text box, my purpose was to .findFirst string in my recordset wich was equal to

Spain" > "Primera División 2019/2020

I ve been trying with no sucess to include in my variable the double quotes around the character >, so I had to go another way and strip all those quotes from my recordset data .

Anyway, I thank you all for your posts, that helped me better understand string manipulation
 
Now that we know the real requirement, consider this test I did which returns ID of only record meeting criteria.
Code:
Sub test()
Dim rs As DAO.Recordset
Set rs = CurrentDb.OpenRecordset("SELECT * FROM Umpires")
rs.FindFirst "[Address] LIKE '*" > "*'"
Debug.Print rs!ID
End Sub
 
Last edited:
rs.FindFirst "[Address] LIKE '*" > "*'"
Debug.Print rs!ID

somehow, to me it returns the first record in the recordset wich does not contain " > "
 
What about?

Code:
rs.findfirst "[Address] Like '*" & chr(62) & "*'"

chr(62) is the ascii code for the > symbol.
 

Users who are viewing this thread

Back
Top Bottom