Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
dj dj is offline
external usenet poster
 
Posts: 92
Default Can you open Access Database through Excel VBA?

Hello,

I am writing an excel macro that would do various things, and at the end I
would like for it to open up an Access Database. This database would then
run an autoexec macro and print reports. Is it possible to write code in VBA
to open an Access Database? And what would the line of code be to do this?

Any help is much appreciated!
THANKS!
  #2   Report Post  
Posted to microsoft.public.excel.programming
XP XP is offline
external usenet poster
 
Posts: 389
Default Can you open Access Database through Excel VBA?

One way:

Copy the following function into a standard code module and call like so:

Sub TestLoad()

'your code
Call AccessLoadApplication
'your other code
end sub

Public Function AccessLoadApplication()
'LOAD ACCESS APPLICATION
Static appXS As Object
Set appXS = CreateObject("Access.Application")
appXS.Visible = True
End Function

HTH

"dj" wrote:

Hello,

I am writing an excel macro that would do various things, and at the end I
would like for it to open up an Access Database. This database would then
run an autoexec macro and print reports. Is it possible to write code in VBA
to open an Access Database? And what would the line of code be to do this?

Any help is much appreciated!
THANKS!

  #3   Report Post  
Posted to microsoft.public.excel.programming
dj dj is offline
external usenet poster
 
Posts: 92
Default Can you open Access Database through Excel VBA?

THANKS!!!

"XP" wrote:

One way:

Copy the following function into a standard code module and call like so:

Sub TestLoad()

'your code
Call AccessLoadApplication
'your other code
end sub

Public Function AccessLoadApplication()
'LOAD ACCESS APPLICATION
Static appXS As Object
Set appXS = CreateObject("Access.Application")
appXS.Visible = True
End Function

HTH

"dj" wrote:

Hello,

I am writing an excel macro that would do various things, and at the end I
would like for it to open up an Access Database. This database would then
run an autoexec macro and print reports. Is it possible to write code in VBA
to open an Access Database? And what would the line of code be to do this?

Any help is much appreciated!
THANKS!

  #4   Report Post  
Posted to microsoft.public.excel.programming
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

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 300
Default Can you open Access Database through Excel VBA?

On Mon, 8 May 2006 16:41:00 -0500, amrezzat
wrote:

Set dbnorthwind = OpenDatabase(dbpath)


You will also need to set a VBA Tools - References... to Microsoft DAO 3.6
Object Library.

Don <www.donwiss.com (e-mail link at home page bottom).
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Open Access Database from Excel Manuel Excel Programming 1 January 12th 06 07:27 AM
Open Access Database through Excel jojo Excel Programming 3 March 3rd 05 06:53 PM
How do I open Access database from Excel Nico Excel Programming 1 December 14th 04 01:06 PM
Can't re-open Access database from Excel VBA Helge V. Larsen[_3_] Excel Programming 0 November 4th 04 09:03 AM
Open Ms Access database with excel macro Sani Excel Programming 2 November 19th 03 06:06 AM


All times are GMT +1. The time now is 07:32 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"