View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
M C Del Papa M C Del Papa is offline
external usenet poster
 
Posts: 2
Default VBA to open a .mdb file

Hi EMoe,

Congratulations! You are about to enter the wonderful world of DAO or Data
Access Objects. DAO is how microsoft exposes Access objects to VBA. The
steps are such:

1. Make sure DAO is referenced within your VBA project. Go to Tools -
References - and select Microsoft DAO 3.x Object Library
2. Once this is open you will be able to insert the objects and methods that
allow you to control Access within VBA.
3. The programming from this point is actually quite elaborate and requires
some experience and knowledge of databases. I suggest consulting the online
help as it is actually very good.

With that said, here are the very simple steps that will at least "Open" the
mdb:

Dim wrkJet As Workspace
Dim dbsNorthwind As Database

Set wrkJet = CreateWorkspace("", "admin", "", dbUseJet)

' Open Database object from saved Microsoft Jet database for exclusive use.
Set dbsNorthwind = wrkJet.OpenDatabase("Northwind.mdb", _
True)

Good luck!

M C Del Papa

"EMoe" wrote in message
...

Hello programmers!

I want to use vba code to open a Microsoft Access File.

Below is the path. I tried to record the action, but it didn't work.

I:\Documents\SHIFTLOG\Shiftlog with Prod.mdb

Thanks,
EMoe


--
EMoe
------------------------------------------------------------------------
EMoe's Profile:
http://www.excelforum.com/member.php...o&userid=23183
View this thread: http://www.excelforum.com/showthread...hreadid=495854