Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Help   Contact   Merch   Join   Order   Logon   Forums   
 
Home > Forums > Access Forum > chr34 or dblquotes by Gregory Clancey
Back to Access Forum    Comments List
Upload Images | @Reply | Bookmark | Link | Email | Next Unseen |
chr34 or dblquotes
Gregory Clancey 
    
3 years ago
Out of ancient habit, I customarily type   Chr(34) & "lteral string" & Chr(34)    when code execution requires enclosing a literal string. Is it better to use the double quotes? I've always avoided this as a confusion.
Alex Hedley  @Reply  
           
3 years ago
Me too, think it reads easier
Gregory Clancey OP  @Reply  
    
3 years ago
Thanks!
So the only real big misstep of these past 40 or so years was saying "I do" rather than "let me think about it (??)"
Sandra Truax  @Reply  
         
3 years ago
@Alex or Gregory - Would you show an example of using Chr(34)?  I tried, and get an error. Below is the line I tried to change, but I get an error.

CurrentDb.Execute "INSERT INTO SeriesT (Series) VALUES (""" & NewData & """)"
CurrentDb.Execute "INSERT INTO SeriesT (Series) VALUES (" Chr(34) & NewData & Chr(34) ")"

Gregory Clancey OP  @Reply  
    
3 years ago
Hi, ST. I think the problem is that, often, the Chr(34) must be concatenated. Thus:  & Chr(34) & NewData & Chr(34) & ")"
See if this does the trick. You can also use the single-quote (') instead of Chr(34) if this is less confusing.
It's odd, but I've been using "Chr(34)" since my "Paradox" days -- centuries ago! The form must have been Chr$34 or something, because I continue to 'say' "STRING" when I type the open paren (even though I don't type $). Old dogs.
Alex Hedley  @Reply  
           
3 years ago
Always break it up into steps, one by one, checking it still works at each stage.
Firstly do it with an actual value

INSERT INTO SeriesT (Series) VALUES ("A")

Then what is the thing you want to substitute?
Gregory Clancey OP  @Reply  
    
3 years ago
Agreed. Well said, lad. Who would run through a mine field, but instead take slow, measured steps and smile after each proves a safe placement.
Gregory Clancey OP  @Reply  
    
3 years ago
I personally don't use the double quote. Instead, use the ASCII character code for the double-quote (which is Chr(34)) to avoid confusion. Also, to avoid over crowding, I don't bother with naming the "table." stuff. The field name alone should suffice. Of course, this may mean no using the "utility" and working out the SQL to VBA string concatenation on your own. Ah, well. Had we some other pressing matter to attend? Italians say "Cheap is expensive, expensive is cheap." I find that what promises to be the short cut is often the long frustration that occurs just before you just do the thing the "long way."
Kevin Yip  @Reply  
     
3 years ago
You can use Chr(34) to avoid using double double-quotes.  For instance:

You can write:   s = Chr(34)
instead of:    s = """"

Or you can write:     sql = "SELECT * FROM Table1 WHERE field1=" & chr(34) & "value" & chr(34)
instead of:     sql = "SELECT * FROM Table1 WHERE field1=""value"""

But many would find the latter cases not that big of a deal.
Sandra Truax  @Reply  
         
3 years ago
I've decided that the double double quotes is less confusing! LOL
Richard Rost  @Reply  
           
3 years ago
That's why I wrote the DDQ function. All you have to say is:

ID = DLookup("AuthorID","QuoteT","FullText=" & DDQ(TextLookupField))

or

CurrentDb.Execute "INSERT INTO SeriesT (Series) VALUES (" & DDQ(MyValue) & ")"

I don't use it myself because I've been writing these damn double-double quotes for 30 years, so it's second nature to me, but I find it helps new developers.
Gregory Clancey OP  @Reply  
    
3 years ago
That's such an elegant solution. You're right, our attention gets hijacked by the prejudice of personal habit. Often (as a fault, I'm certain) code written with conventions every bit as good as -- but different than -- what I've been using for years tends to draw my focus to issues that don't really matter. It's like speaking with someone from a foreign country whose accent doesn't make their English any less comprehendible but seems almost like always having a tiny pebble in your shoe.
Sandra Truax  @Reply  
         
3 years ago
Thank you Richard!  I'm getting better at the double quotes, but do get stuck sometimes.  Thanks for the code.

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Access Forum.
 

Next Unseen

 
 
What's This?

 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2026 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 11/15/2026 12:57:21 AM. PLT: 0s