Thread: double quo
View Single Post
  #6  
Old October 5th, 2006, 03:45 PM posted to microsoft.public.access.forms,microsoft.public.access.formscoding,microsoft.public.access.modulesdaovba,microsoft.public.access.reports
Douglas J. Steele
external usenet poster
 
Posts: 9,313
Default double quo

Quotes must always be balanced (i.e.: there must always be an even number of
them in a string). In your first example ?Asc("""), you've got an odd number
of quotes.

Now, you're essentially trying to create a string that contains a double
quote. Since you're trying to create a string, you have to have double
quotes at the beginning and end of the string. To represent a double quote
inside the string, you need to have two double quotes (since quotes always
have to be balanced).

Try ?Asc(""""). You should get 34.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"BruceM" wrote in message
...
I guess I'll just have to accept that it works, and forget about
understanding how. My single biggest difficulty with VBA is understanding
quotes. I have read all kinds of explanations, but somehow I just can't
seem to get it. If I enter ?Chr(34) or ?Chr$(34) in the immediate window I
get a double quote, yet ?Asc(""") returns an error, even though Asc("'")
returns 39. In all cases except the double quote (all cases of printing
characters, at least, as far as I can tell), the Asc function returns the
literal value betweeen the double quotes, except when the literal value is
a double quote, in which case all bets are off.


Douglas J. Steele" wrote in message
...
In code, """" (four double quotes in a row) results in a one double
quote. Chr$(34) also results in a one double quote.

From the Immediate window (Ctrl-G)

?"""" = Chr$(34)
True


--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"BruceM" wrote in message
...
I'm curious as to how Chr(34), which is as I understand it a double
quote, could substitute for a pair of doubled quotes. I have seen this
suggestion before, but I don't understand it.

"Sylvain Lafontaine" sylvain aei ca (fill the blanks, no spam please)
wrote in message ...
Each double quote delimited by other double quotes must be doubled:

If temp_word """" Then ...

You could also use Chr(34):

If temp_word Chr(34) Then ...

--
Sylvain Lafontaine, ing.
MVP - Technologies Virtual-PC
E-mail: http://cerbermail.com/?QugbLEWINF


"00KobeBrian" wrote in message
...
I tried to write the following code in a module:

If temp_word """ Then

End If

But given syntax error. I want to check if the temp_word is equal to
a double quotation mark. How can I achieve this? Thanks.