Drew Wutka
DWUTKA at marlow.com
Tue Sep 23 21:20:38 CDT 2003
Dim Acc As Access.Application
Set Acc = CreateObject("Access.Application")
Acc.OpenCurrentDatabase "G:\SHARED\Productivity Reports\Oleg\db2.mdb"
Acc.DoCmd.OpenReport "Project Box Sheet", acPreview
Acc.CloseCurrentDatabase
Acc.Quit
Set Acc = Nothing
That should work...if your report prompts the user, then the Access session
is going to lock the thread you are using in VB. The code above is a
modified version of my 'WolfWeb' project, which is designed to run a report
that prompts the user for criteria.
Drew
-----Original Message-----
From: Oleg_123 at xuppa.com [mailto:Oleg_123 at xuppa.com]
Sent: Tuesday, September 23, 2003 3:16 PM
To: accessd at databaseadvisors.com
Subject: [AccessD] OT: Opening Access report from Visual Basic
Hi Group,
I am trying to open an Access Report from Visual Basic form, doesn't seem
to be working. I think that i used something like this in the past. (I
checked Microst Access 9.0 Object library in references)
Dim Acc As Object, db As Object
Dim dbPath As String
Set AccObj = CreateObject("Access.Application")
Set db =
AccObj.Application.DBEngine.Workspaces(0).OpenDatabase(dbPathName)
dbPath = "G:\SHARED\Productivity Reports\Oleg\db2.mdb"
AccObj.OpenCurrentDatabase dbPath, False
Set db = Nothing
AccObj.DoCmd.OpenReport "Project Box Sheet", acPreview
AccObj.Visible = True
-----------------------------------------
Get Breaking News from CNN, ABC, NBC, CBS Now.
http://www.xuppa.com/news/?link=webmail
_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com