View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
amrezzat[_29_] amrezzat[_29_] is offline
external usenet poster
 
Posts: 1
Default Can you open Access Database through Excel VBA?


Dim dbnorthwind As DAO.Database
Dim dpath As String
dbpath = "C:\Program Files\Microsoft
Office\OFFICE11\sAMPLES\northwind.mdb"
Set dbnorthwind = OpenDatabase(dbpath)

Dim rseployees As DAO.Recordset
Dim rscustomers As DAO.Recordset
Set rseployees = dbnorthwind.OpenRecordset("employees", dbOpenTable)
Set rscustomers = dbnorthwind.OpenRecordset("customers", dbOpenTable)
i = 2

With rseployees

If Not .EOF Then .MoveFirst
Do While Not .EOF
Cells(i, 1).Value = .Fields(2)
Cells(i, 2).Value = .Fields(1)
MoveNext
i = i + 1
Loop

End With


--
amrezzat
------------------------------------------------------------------------
amrezzat's Profile: http://www.excelforum.com/member.php...o&userid=28766
View this thread: http://www.excelforum.com/showthread...hreadid=540002