Open Access Report with Criterion

Asked

Viewed 93 times

1

I’m a beginner in C# and I’m opening a report on Access, but this report has criteria, that is, it depends on a numbering to open.

This numbering I have in a textbox and my doubt is how to pass the value of this textbox straight to the report of Access when it is opened.

Follow 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();

1 answer

0

I managed to fix it. 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();

Browser other questions tagged

You are not signed in. Login or sign up in order to post.