How to run MS access report in C# while keeping acces UI hidden?

  • Thread starter Thread starter Jama
  • Start date Start date
J

Jama

I have access application AddressDB.adp containing access reports among
other things. I want to run the report viewer without showing the access
application UI.

I am using C# and MS access and I call the Run_Access Method bellow to open
the acces application. I set the
access.Visible = false; but still I get the Access UI opening and that
happens when I call OpenCurrentDatabase or OpenAccessProject. How can I
prevent access UI showing?

private void Run_Access_Report(string reportName)
{
Access.Application access = null;
try
{
access = new Access.ApplicationClass();
access.Visible = false; //open access in the background
string databasePath = Path.Combine(DB_PATH, "AddressDb.adp");

// using Access 10.0 object library
access.OpenCurrentDatabase(databasePath, false, null);
RunReport(Access, reportName)
}
finally
{
if (!access.UserControl) access.UserControl = true;
DisposeAutomation(access);
access = null;
}
}
The code above works but fist it opens MS Access and then it shows the
report. I would like to see only the report viewer.

Thanks
 
It is not possible to view an Access Report without showing the
Access Application UI.

Unlike forms, which can be constructed with the Desktop as
parent, reports can only be constructed as Application client
windows.

If you work on it, you can hide the menu's. If you work on it, you
can modify the window title. If you work very hard, you can modify
the application window (the close/minimise/restore buttons).

You may also be able to force the report to go to full screen mode,
entirely hiding Windows and the application window frame.

It might also be possible to print a report to pdf or snapshot while
the Application window is hidden.


(david)
 
I have a sample application that is using Northwind.mdb and the same code and
shows only the report viewer without MS Access UI. Is there a difference
between the .MDB and .adp extensions when it comes to automation?

Thanks
 
Ask in access.reports. What version of Access are you using?
Where in Northwind does this happen? What do you mean by
'the viewer'?

You can't view Access reports without Access, but you can
view PDF's, snapshots and MS Document format without
Access.

(david)
 
Hi

Can you pls let me know, how you made showing the report viewer directly
without MS Access UI. my email id is

gajapathy74 at hotmail dot com
 
Back
Top