Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Forums   Help   Contact   Merch   Join   Order   Logon  
 
Back to Access Forum    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
Changing SQL Statement
John Davy 
         
6 years ago
Hi Rick,

Can we change an SQL statement from a query so it can be run as a  Run SQl statement.
Can we format it with proper line breaks and quotes so I can just copy it and run it?

Thanks
John
Richard Rost  @Reply  
          
6 years ago
Sure. Just copy it from the SQL view in the query, paste it into code, and then add quotes and line breaks where needed.
John Davy OP  @Reply  
         
6 years ago
Hi, I wanted to know if the quotes and lines breaks could be added by vba.

Thanks
John
Richard Rost  @Reply  
          
6 years ago
No... but I could probably write a little routine that would do it... would make an interesting little video. I'll add it to the TechHelp list. :)
Richard Rost  @Reply  
          
6 years ago
Figured it out in about 30 seconds. I made a neat little tool to do it. TechHelp video coming soon for it...
Richard Rost  @Reply  
          
6 years ago
How does this look for tomorrow's TechHelp video? I'll run down the basics of how to do it in the Free TechHelp video, and then I'll go over the really cool extra stuff I added in the Extended Cut, like splitting up long lines, picking a query from the list of queries in the database, and adding the commands.

John Davy OP  @Reply  
         
6 years ago
Wow! This is the part that concerns me - "Figured it out in about 30 seconds."  John
William Dowler  @Reply  
      
6 years ago
Richard,
Great idea. This would save a lot of time.
Richard Rost  @Reply  
          
6 years ago
Yeah, I figured out the basics of how to do it in about 30 seconds. It's just simple string manipulation. As long as you understand the vbNewLine character, it's not that hard. Then I ordered a pizza for dinner last night and while I was waiting for the pizza to arrive I decided to flesh it out a bit. Getting ready to record the videos now. :)
Richard Rost  @Reply  
          
6 years ago
Here you go, John. It took me three times as long to record the videos than to build the actual database. But, that's what I do. Hopefully it will help other people as well. Convert SQL to VBA. You've been enshrined in TechHelp glory. You're famous now.

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

Next Unseen

 
New Feature: Comment Live View
 
 

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: 6/16/2026 11:18:52 AM. PLT: 1s