Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Opening Access Reports

Status
Not open for further replies.

itechC

Programmer
Feb 13, 2003
71
0
0
CA
Hi all,

I'm using access as a back end to my vb project. I'm opening reports i created in access. The only problem is that when i view a report Microsoft Access opens as well. Is there any way to hide this window. Here is what i'm doing.

Const strPassword = "123"
Dim Acc As Object, db As Object
Dim dbPathName As String
dbPathName = App.Path & "\EuroGlobaldb.mdb"

Set Acc = CreateObject("Access.Application")
Set db = Acc.Application.DBEngine.Workspaces(0).OpenDatabase(dbPathName, 0, False, ";pwd=" & strPassword)
Acc.OpenCurrentDatabase dbPathName, False
Set db = Nothing
Acc.Visible = True
Acc.DoCmd.OpenReport "clients", acPreview, , acWindowNormal
Set Acc = Nothing
 
which window are you talking about...

use

Acc.DoCmd.Minimize

you can minimize the window....
 
Try Acc.DoCmd.OpenReport "clients", acViewNormal

-vza
 
You can make an API call in the startup form of the access project to hide the access window but continue to show the forms/reports. e.g.
Code:
Private Declare Function apiShowWindow Lib "user32" _
Alias "ShowWindow" (ByVal hwnd As Long, _
ByVal nCmdShow As Long) As Long

Function fSetAccessWindow(nCmdShow As Long)
Dim loX  As Long
loX = apiShowWindow(hWndAccessApp, nCmdShow)
fSetAccessWindow = (loX <> 0)
End Function

Private Sub Form_Open(Cancel As Integer)
fSetAccessWindow 0
End Sub

----------------------------------------------------------------------

Need help finding an answer?

Try the search facilty ( or read FAQ222-2244 on how to get better results.
 
Or, use what I posted in this thread to hide the DB Window:
thread222-426238
 
oh, that thread didn't have what I meant.

Then put this at the declaration section:
Const acCmdAppMaximize = 10
Const acCmdWindowHide = 2

Then use the following after opening the DB but PRIOR to calling the OpenReport method:

.DoCmd.RunCommand acCmdWindowHide
.DoCmd.RunCommand acCmdAppMaximize
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top