ruby_yeheskel
asked on
Microsoft Access Reports Automation
I'm Using Visual Basic To Open An Access Report Like This:
Private Sub CmdOpenReport_Click()
RunReport "report1", "Customers.CustomerID='111 11111'"
End Sub
Public Sub RunReport(strReport As String, Optional WhereCondition As String)
Dim mobjAccess As Object
Set mobjAccess = New Access.Application
mobjAccess.DoCmd.Hourglass True
' Open the database
mobjAccess.OpenCurrentData base CurrentDbPath
' Open the report in preview mode
mobjAccess.DoCmd.OpenRepor t strReport, acViewPreview, , WhereCondition
' Maximize the report window
mobjAccess.DoCmd.Maximize
' Show the Access window
mobjAccess.Visible = True
mobjAccess.DoCmd.Hourglass False
End Sub
My Problem Is That I Want To Leave Access Application Open After Leaving The "RunReport" Sub And Let The User Print His Report Wherever He Like.
That's Why I'm Not Closing My "mobjAccess" Object At The End Of My Sub.
So Why When I'm Leaving The Sub The Access Application
Is Closing ?
How Can I Leave The Access Application(My Specific Report) Open ?????????????????
Private Sub CmdOpenReport_Click()
RunReport "report1", "Customers.CustomerID='111
End Sub
Public Sub RunReport(strReport As String, Optional WhereCondition As String)
Dim mobjAccess As Object
Set mobjAccess = New Access.Application
mobjAccess.DoCmd.Hourglass
' Open the database
mobjAccess.OpenCurrentData
' Open the report in preview mode
mobjAccess.DoCmd.OpenRepor
' Maximize the report window
mobjAccess.DoCmd.Maximize
' Show the Access window
mobjAccess.Visible = True
mobjAccess.DoCmd.Hourglass
End Sub
My Problem Is That I Want To Leave Access Application Open After Leaving The "RunReport" Sub And Let The User Print His Report Wherever He Like.
That's Why I'm Not Closing My "mobjAccess" Object At The End Of My Sub.
So Why When I'm Leaving The Sub The Access Application
Is Closing ?
How Can I Leave The Access Application(My Specific Report) Open ?????????????????
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
kfrick,
Thanks
You Know Sometimes The Head Is Not Working.
Thanks
You Know Sometimes The Head Is Not Working.
Dim mobjAccess As Object ' hummm....
Dim mobjAccess As Access.application ' :)