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 Developer Forum    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
SQLite3 ODBC vba code
Max Morrow 
     
3 years ago
I have software that uses SQLite3 databases to store customer info. We have billing information stored in the SQLite3 databases that I pull out Manually. I have installed the ODBC SQLite driver. I want to Write VBA code to automate this function. I have not had much luck finding the documentation for the SQLite driver. I have been trying to use the DoCMDTransferDatabase, acImport function with no success. I am not sure the DoCMD will work, but I spend a great deal of time every week pulling the billing out of several dozen customer files.
Richard Rost  @Reply  
          
3 years ago
Sorry, but I have never used SQLite.
Larry Royer  @Reply  
        
3 years ago
I am having the same issue attempting to export tables from an Access DB to SQlite DB tables.  I have the Devart SQLite ODBC driver installed and it works perfectly to export tables, one at a time, from the Access DB using the SQlite ODBC.  However, when I attempt do this from within Access VBA using DoCmd.TransferDatabase in order to loop through multiple tables to export instead of one at a time.  It always errors with "Run Time Error [Micrsoft] [ODBC Manager] Data Source name not found and no default driver specified (#0)".  I have tried many combinations in the ODBC section of the DoCmd.TransferDatabase parameters and, so far, nothing works.  What is strange, it works so well with the same SQLite ODBC driver and SQLite DB as is referenced in those parameters using the standard Access Export ODBC SQLlite.
Alex Hedley  @Reply  
            
3 years ago
Need to test but found this on SO.

Dim conn As Object, rst As Object

Set conn = CreateObject("ADODB.Connection")
Set rst = CreateObject("ADODB.Recordset")

' OPEN CONNECTION
conn.Open "DRIVER=SQLite3 ODBC Driver;Database=C:\Path\To\SQLite\Database.db;"

strSQL = "SELECT Vessels.vsl_name, Vessels.dwt FROM Vessels " & _
         " GROUP BY Vessels.vsl_name, Vessels.dwt ORDER BY Vessels.vsl_name ; "

' OPEN RECORDSET
rst.Open strSQL, conn

' OUTPUT TO WORKSHEET
Worksheets("results").Range("A1").CopyFromRecordset rst
rst.Close

' FREE RESOURCES
Set rst = Nothing: Set conn = Nothing
Larry Royer  @Reply  
        
3 years ago
Thank you for the reply.  I just got mine to work by downloading and using a different SQL3 ODBC driver.  i didn't change anything in the code but changed the ODBC DSN and driver using the exact same DoCmd.TransferDatabase parameters and it worked perfectly.  it was just that other ODBC driver didn't work from VBA for some reason.  I will try your code with the original ODBC driver and see if it will work also.  Thanks again!!!
Alex Hedley  @Reply  
            
3 years ago
Great to hear it's working now.

What SQLite GUI are you using to interrogate that db?
Larry Royer  @Reply  
        
3 years ago
Tried your code and it worked with the new SQL ODBC driver but not the original one.  The original driver is causing the issue in Access VBA, but will export tables to SQLite DB using the Access Export ODBC and that driver.  Everything is good now because the new driver works perfectly for Access export ODBC and within VBA.
Larry Royer  @Reply  
        
3 years ago
Missed your question.  I use SQLite DB Browser to access the SQLite DBs and the SQLite Export Access DB that I am using to export multiple tables to SQLlite is: https://blog.stranianelli.com/how-to-convert-mdb-files-to-sqlite-database.  There are 2 download files from that site: ExportMDBToSQLite3.mdb and NewSQLiteDB.db. i am using Export Access DB.

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Access Developer 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: 5/17/2026 12:47:22 AM. PLT: 0s