I'm trying to generate PDF from Access report. Report pop's up dialog "Enter Parameter Value". How I could fill it with C#? Is it even that reportParameter (whereCondition)?
using System;
using MsAccess = Microsoft.Office.Interop.Access;
namespace mdb2pdf
{
class Program
{
public static void Main(string[] args)
{
string MDBFile = @"d:\example.mdb";
string PDFFile = @"d:\example.pdf";
string reportName = @"myReport";
string reportParameter = @"[Name?] LIKE 'myName'";
MsAccess.Application app = new MsAccess.Application();
app.OpenCurrentDatabase(MDBFile, false, "");
app.DoCmd.OpenReport(reportName, Microsoft.Office.Interop.Access.AcView.acViewPreview, Type.Missing, reportParameter, MsAccess.AcWindowMode.acWindowNormal, Type.Missing);
app.DoCmd.OutputTo(MsAccess.AcOutputObjectType.acOutputReport, reportName, MsAccess.Constants.acFormatPDF, PDFFile, Type.Missing, Type.Missing, Type.Missing);
app.CloseCurrentDatabase();
}
}
}