Ho can I create a new Access database file for Elipse E3 at runtime?
The Database is an Elipse E3 object used for storing the project’s information regarding Historics, Formulas, and Alarms. It can support the following formats: MDB (Microsoft Access), Oracle, and Microsoft SQL Server.
Microsoft Access is a database management system provided by Microsoft. It comes with the Microsoft Office package, and can use any information that has been stored in any data receptacle in the ODBC. If you’re still not sure which database model is the right one for your project, you can check out our article KB-31974: Databases: comparing models to help you make an informed decision.
In order to create a new Access database file from scratch at runtime, you must first follow a few guidelines. First of all, you will need to deactivate all database objects, such as: databases, Historics, and Storage. Then, you must edit the database file; only after you’ve made these changes that can you you reactivate these objects.
Set objHist = Application.GetObject("Hist1") Set objDB = Application.GetObject("BancoDados1") 'Deactivate database objects objDB.Deactivate() objHist.Deactivate() 'Create a new file based on current data Call objDB.SetDBParameters("C:\CaminhoPastas\Dados_"&Day(Now)&"_"&Month(Now)&"_"&Year(Now)&".mdb", "", "", "") objDB.Save 'Reactivate all database objects objDB.Activate() objHist.Activate()
- Structure Query Language (SQL): Chapter 3 – Data Discard and DB Limits.
- Structure Query Language (SQL): Chapter 4 – Backup.
- KB-31974: Databases: comparing models.