Meaning of """

F

Frank Situmorang

Hello,

Anyone can help me what is the maaning of this """ and 9999 in the following
VBA:
strSQL = strSQL & "WHERE (((Left([AddresID], 4)) = """
strSQL = strSQL & Right("000" & Nz(DLookup("Church", _
"Defaults"), "9999"), 4) & """))"
strSQL = strSQL & "ORDER BY AddresID DESC;"

Where can we know the list of all VBA and what is it for.

Thanks in advance,

Frank
 
S

Stefan Hoffmann

hi Frank,

Frank said:
Anyone can help me what is the maaning of this """ and 9999 in the following
VBA:
strSQL = strSQL & "WHERE (((Left([AddresID], 4)) = """
strSQL = strSQL & Right("000" & Nz(DLookup("Church", _
"Defaults"), "9999"), 4) & """))"
strSQL = strSQL & "ORDER BY AddresID DESC;"
Either MsgBox strSQL or Debug.Print strSQL. Using Debug.Print, you will
find the output in the immediate window of the VBA IDE.
Where can we know the list of all VBA and what is it for.
F1.

When using the double quote as string delimiter in SQL statements you
have to escape them. Otherwise the VBA interpreter/compiler could not
distinguish between content and code.
You escape a single double quote by doubling it, so when your text is:

--
I said: "Go!"
--

Then it must be:

strSQL = "I said: ""Go!"""

The other solution is to use single quotes when creating SQL statements:

strSQL = strSQL & _
"WHERE Left([AddresID], 4) = '" & _
Right("000" & Nz(DLookup("Church", "Defaults"), "9999"), 4) & _
"' " & _
"ORDER BY AddresID DESC;"


mfG
--> stefan <--
 
A

Allen Browne

Since strings are delimited with quote marks, you have to double up the
quotes if you want one in the string.

Details and examples:
Quotation marks within quotes
at:
http://allenbrowne.com/casu-17.html

To get a list of everything that's available in VBA, press F2 in the code
window. This opens the object browser. You can then browse to any object.
 

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