[AccessD] OT: Opening Access report from Visual Basic

Oleg_123 at xuppa.com Oleg_123 at xuppa.com
Wed Sep 24 09:52:26 CDT 2003


Thanks Marty, this seems to be working; actually I made it work yesterday
with a slightly different code. Now, is there a way to for a report to
open at full size ? I guess someithing "On Load" event of the report ?


> try this; close just some lines in wrong spot
>
> Sub testreport()
> Dim AccObj As Object
> Dim db As Object
> Dim dbPath As String
> dbPath = "G:\SHARED\Productivity Reports\Oleg\db2.mdb"
>   Set AccObj = CreateObject("Access.Application")
>   Set db =
> AccObj.Application.DBEngine.Workspaces(0).OpenDatabase(dbPath)
>
>       AccObj.Visible = True
>       AccObj.OpenCurrentDatabase dbPath, False
>       AccObj.DoCmd.OpenReport "Project Box Sheet", acPreview
>       AccObj.Visible = True
>       ' quit the application too if necessary
>       'AccObj.quit
>    Set db = Nothing
>    Set AccObj = Nothing
>    '
> End Sub
>
> Oleg_123 at xuppa.com wrote:
>
>>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
>>
>>
>>
>
>
> _______________________________________________
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com



-----------------------------------------
Get Breaking News from CNN, ABC, NBC, CBS Now.
http://www.xuppa.com/news/?link=webmail




More information about the AccessD mailing list