0

So bassicly im using an OfficeLine which is running on Access and my programms are list like that:

List of Officline programms

and now I want one of them open from C#.

I tried to use Interop.Access for that because my C# programm is an Class Library program.

And then to get all Forms from Access because in my Task manager my Officline is looking like that:

Task Manager look

and I get the Form with that Code:

foreach (Form form in accessApp.Forms)
                {
                    try
                    {
                        // Überprüfen, ob Formular geöffnet ist
                        if (!accessApp.Forms[form.Name].CurrentView.Equals(AcFormView.acDesign))
                        {
                            //MessageBox.Show("Das ist der if Block:  " + form.Name);

                            if (form.Name == "frmSysControlCenter")
                            {
                                foreach (Microsoft.Office.Interop.Access.Control control in form.Controls)
                                {
                                    
                                }
                            }
                        }
                        else
                        {
                            MessageBox.Show("Das ist der else Block:  " + form.Name);
                        }
                    }
                    catch
                    {
                        // Falls ein Fehler auftritt, das Formular ist nicht geöffnet
                    }
                }

and frmSysControlCenter should be the Form but now I dont know how to access the formulars from my OfficeLine I thought on something like looking through Controls but that didnt work.

So anyone an Idea how to open an Formular like Stammdaten -> Artikel for example from my first screenshot?

1 Answers1

0

I found an way by myself and it was just to use this:

        dynamic app = Marshal.GetActiveObject("Access.Application");
  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Apr 20 '23 at 18:35