0

What I'd like to do is create a Form in an MS Access database using C#, so I don't have to manually re-create the Form each time a new instance of the database is created.

What I can do successfully is use ADOX to create an Access DB, create an Access Table in the database, write data to a Table, and create an Access Query in the database. I would like to create an Access Form based on that Access Query.

I am using Access 2010 & Visual Studio 2010 with the .NET 4.5 Framework.

This seems like something that would help several C#-to-Access coders, but I haven't found the question asked anywhere on the Internet (eg Google results, StackOverflow), or in MSDN documentation for ADOX. I'm coming to the conclusion not a lot of people create Access DBs with C#, and/or it's not possible to add a Form using C#.

Any search terms, code samples or other advice will be much appreciated.

  • Really depends on your requirements. If it's the exact same Access database design everytime, you could create an Access database template file, and just insert the data into it. Another option would be use COM Automation. ADOX will not work with Access forms at all. – Fink Apr 17 '15 at 19:48
  • 1
    Yes, this is all possible with COM automation. Create the database, create the table using ADOX DDL, and then create the form using "CreateObject". – DataWriter Apr 17 '15 at 20:18
  • @Fink The template file is an interesting idea, but I don't think it will work for this project. RE COM Automation and CreateObject (great leads, ty Fink & DataWriter), it looks like that is usually done with VB code. Any recommendations beyond what is in [this thread](http://stackoverflow.com/questions/13719579/equivalent-code-of-createobject-in-c-sharp) ? – helloThere Apr 18 '15 at 20:21

0 Answers0