Open Access Report with Criteria

1

I'm a beginner in C # and am opening an Access report, but this report has criteria, ie, depends on numbering to open.

This numbering I have in a textbox and my question is how to pass the textbox value directly to the Access report when it is opened .

Here is the code I use to open the report:

Microsoft.Office.Interop.Access.Application accessApp = new Microsoft.Office.Interop.Access.Application();         accessApp.OpenCurrentDatabase(@"E:\Desenvolvimento\C#\ReciboFácil\ReciboFácil\bin\Debug\ReciboFacil.mdb");
accessApp.DoCmd.OpenReport("ReciboServiço");
accessApp.CloseCurrentDatabase();
accessApp.DoCmd.Quit();
    
asked by anonymous 11.11.2017 / 23:22

1 answer

0

I managed to resolve. I changed the code as follows: Microsoft.Office.Interop.Access.Application accessApp = new Microsoft.Office.Interop.Access.Application(); accessApp.OpenCurrentDatabase(@"E:\Desenvolvimento\C#\ReciboFácil\ReciboFácil\bin\Debug\ReciboFacil.mdb"); accessApp.DoCmd.OpenReport("ReciboServiço", AcView.acViewNormal,"", "[codrecibo]=" + codrecibo); accessApp.CloseCurrentDatabase(); accessApp.DoCmd.Quit();

    
12.11.2017 / 03:13