Education is the most powerful weapon
which you can use to change the world.
-Nelson Mandela
 
Home   News   Courses   Seminars   Templates   Help   TechHelp   Forums   Order   Contact   Logon  
 
Home > TechHelp > Directory > Access > SQL to VBA < Alpha Grouping | Fast Form Update >
 
Convert Query SQL to VBA
By Richard Rost   Richard Rost on Twitter Richard Rost on LinkedIn Email Richard Rost   23 days ago

Convert Query SQL to VBA Code. Add Line Breaks, Quotes, More.


 S  M  L  XL  FS  Join Now

Do you copy a lot of SQL from the query designer SQL view over to the VBA editor to use in your code, and you spend a lot of time "fixing" the string, adding line continuation characters, adding quotes, etc. Well, in this video we'll make a little utility you can use to perform that task with one click. You can use this in a RunSQL statement or a Me.RecordSource change.

John from Hancock, New Hampshire (a Silver Member) asks: Is there a way to format the SQL text of a query with the proper line breaks and quotes so I can copy it to my VBA editor for a RunSQL command without doing all that manual editing?

Members

I'll walk you through some additional modifications to the utility, including splitting long lines up, loading a listbox with all of the queries in the database, and one-click to copy the SQL to the editor textbox and convert it.

Silver Members and up get access to an Extended Cut of this video. Gold Members can download the database template from class plus get access to the Code Vault. If you signed up on YouTube you have to contact me so I can set up your account here on my web site. If you're not a member, Join Today!

Links

Replace Function: https://599cd.com/Replace
Me.RecordSource: https://599cd.com/RecordSource
Double Double Quotes: https://599cd.com/DoubleDouble
SetFocus: https://599cd.com/SetFocus
Intro to VBA: https://599cd.com/IntroVBA

Learn More

FREE Access Beginner Level 1
Access Level 2 for $1.00

Free Templates

TechHelp Free Templates
Blank Customer Template
Contact Management
Order Entry & Invoicing
More Access Templates

Resources

Mailing List - Get Emails When New Videos Released!
Consulting - Need Help with Your Database?

Questions?

Please feel free to post your questions or comments below or submit them via the TechHelp page.

 

SetWarnings Reversed Link 
James Gray 
10 days ago
I noticed that the VBA code constructed via the utility has the Set Warnings True statement first instead of Set Warning False.   I think the problem is with the construction of Status function.  I fixed it by changing the order of construction for StatusBox to: StatusBox = StatusBox & vbNewLine & S instead of: StatusBox = s & vbnewline & Statusbox.  Do I have this correct?
Richard Rost
10 days ago
You may indeed be correct. I didn't notice it. I'll check the video when I have some free time, but what you're saying sounds about right. Thanks. :)
Add a Reply

Show All Comments

Post a New Comment or Question
 
Only students may post right now. Click here for more information on how you can set up an account. If you are a student, please LOG ON first.
 
Subscribe
 

You may want to read these articles from the 599CD News:

1/7/2021Filter Characters
12/31/2020Convert Query SQL to VBA
12/21/2020Introduction to Access VBA
12/12/2020Customer Contact Template
11/13/2020Calculate Exact Age
11/13/2020myNetWorkDays Function
11/13/2020Easter Sunday Calculation
10/31/2020Current UTC Time
10/16/2020InStr2 Search a List of Chars
10/10/2020Create Your Own Function
 
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Account Login
Online Theater
Downloads
Lost Password
Free Upgrades
Insider Circle
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Articles
Search The Site
Waiting List
Production Schedule
Code Vault
Collapse Menus
Help
 
Live Chat
Customer Support
WalkThru Tutorials
Troubleshooting
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
Order
 
Video Tutorials
Handbooks
MYOLP Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Live Chat
General Info
Support Policy
Contact Form
Email Richard
Mailing Address
Phone Number
Fax Number
Course Survey
Facebook    Twitter

YouTube Channel    LinkedIn

Blog RSS Feed   
Keywords: TechHelp Access line breaks, vbnewline, vbtab, sql to vba, convert sql, convert to vba, line continuation character, runsql, recordsource, setfocus, copy to clipboard  PermaLink