Access snapshot reports via XP interop

S

Scott Mackay

Somebody please help me!

I am trying to generate and save access snapshot reports (using the Office
XP Primary Interop Assemblies in .net) which are viewable through an activex
control in an asp.net webpage.

Everything looks and works ok apart from one issue, the reports I'm
executing are from an Access Project which uses stored procedures from a
linked SQL database, the stored procedures have a parameter called
'MonthyReviewID' which when executing a report causes a dialog box to pop up
on the machine running the access.exe process requesting this parameter.

I don't know how to pass that parameter to the report in my OpenReport
command and then to the stored procedure within the report, otherwise it
causes the application to pop up a dialog requesting the parameter and then
waits for the value, if I enter the value then the report is generated and
everything else works fine (report is generated and loaded into the activex
object on the webpage), but if the user is not accessing the webpage locally
(and they won't be) it is effectively hanging the app because the dialog is
only ever be on the server executing the report.

I'm assuming that the parameter is passed in the last argument of the
OpenReport method (Object OpenArgs) but for the life of me I can't get it to
work. Does anyone know how I can pass this parameter and in what format in
my OpenReport command to avoid these parameter request dialogs?

//Create new access application object
Access.Application appAccess = new Access.ApplicationClass();

try
{
//Open database exclusively
appAccess.OpenAccessProject(this.DatabasePath, true);

appAccess.DoCmd.OpenReport(reportName,
Access.AcView.acViewPreview,
System.Reflection.Missing.Value,
whereCondition,
Access.AcWindowMode.acHidden,
System.Reflection.Missing.Value)

// output snapshot file
appAccess.DoCmd.OutputTo(
Access.AcOutputObjectType.acOutputReport,
reportName,
Access.Constants.acFormatSNP,
outputFile,
false,
null,
null);

appAccess.CloseCurrentDatabase();
}
catch(Exception e)
{
throw new Exception("Cannot generate report");
}
finally
{
appAccess.Quit(Access.AcQuitOption.acQuitSaveNone);
appAccess = null;
}

Thanks in advance
Scott.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top