Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   Index   Templates   Seminars   TechHelp   Forums   Help   Contact   Join   Order   Logon  
 
Home > TechHelp > Directory > Access > SQL to VBA < Alpha Grouping | Fast Form Update >
Convert Query SQL to VBA
By Richard Rost   Richard Rost on LinkedIn Email Richard Rost   4 years ago

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


 S  M  L  XL  FS  |  Slo  Reg  Fast  2x  |  Bookmark 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 view Extended Cut videos, when available. Gold Members can download the files from class plus get access to the Code Vault. 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

Addendums

  • A few of my students have pointed out that the conversion doesn't work properly if you have spaces in your table or field names. Of course, to each of them I have pointed out that one of the very first things I teach in Access Beginner Level 1 is NOT to use spaces in your table or field names - or any object name for that matter. It complicates things. This is one example of that. Is a fix possible? Sure. Am I going to write one? Nope. :)

Extras

Alex's Online SQL to VBA Tool

Learn More

FREE Access Beginner Level 1
FREE Access Quick Start in 30 Minutes
Access Level 2 for just $1

Free Templates

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

Resources

Mailing List - Get emails when new videos released
Consulting - Need help with your database
Tip Jar - Your tips are graciously accepted

Questions?

Please feel free to post your questions or comments below or post them in the Forums.

 

Comments for Convert Query SQL to VBA
 
Age Subject From
7 monthsWhere was this tool when IJeffrey Kraft
17 monthsConvert Query SQL to VBAWilliam Kennedy
3 yearsBlank Space after short linesJohn Michael Fowler
3 yearsAddendumRichard Rost
3 yearsSetWarnings ReversedJames Gray

 

Start a NEW Conversation
 
Only students may post on this page. Click here for more information on how you can set up an account. If you are a student, please Log On first. Non-students may only post in the Visitor Forum.
 
Subscribe
Subscribe to Convert Query SQL to VBA
Get notifications when this page is updated
 
 
 
 

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 2024 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 10/10/2024 12:51:02 AM. PLT: 1s
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  Convert Query SQL to VBA in Microsoft Access