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 
Connecting with DAO
Richard Stein 
      
2 years ago
May the Schwartz be with you!

I am able to connect and run my code using DAO as long as the database is open and has focus.  I am trying to simply access the db whehter it is open or not.  I have used many iterations of code only to fail.

The error for this screen shot is object required.
Richard Stein OP  @Reply  
      
2 years ago

Richard Rost  @Reply  
          
2 years ago
Are you trying to do this from Excel?
Kevin Yip  @Reply  
     
2 years ago
OpenDatabase requires a string as its argument, so DaoConStr should be declared as a string, not a Name object.
Garry Smith  @Reply  
    
2 years ago
'How to Open Another MS Access Database from Your Database
'This will read a field in a table from another database that is not open and then closes it

    'Opens another database from the current open database
Dim app As Access.Application
Dim wks As Workspace
Dim db As Database
Dim rst As DAO.Recordset
    Set app = New Access.Application
    Set wks = app.DBEngine(0)
    Set db = wks.OpenDatabase("C:\DBs Flex-3rd\SubjectsMain-Access-VBA_BE")
    Set rst = db.OpenRecordset("AabTS_Constants", dbOpenSnapshot)

'Do Until rst.EOF
'        Debug.Print rst!RootDoc_ImgFolder
        Me.txtResult = rst!RootDoc_ImgFolder.Value
'Call ListFieldsAndTypes(rst)
'rst.MoveNext 'remember this or it goes forever!
'Loop
rst.Close
Set rst = Nothing
Set db = Nothing
Set wks = Nothing
app.Quit
Richard Stein OP  @Reply  
      
2 years ago
Wow,  That is so helpful.  I can accs the db whenever I want.

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: 5/6/2026 11:20:54 AM. PLT: 0s