Closed siddish-reddy closed 4 years ago
To create a password-protected database from scratch you need to use the Access Database Engine, Access DAO (Data Access Objects), and pywin32. In other words, you don't need to use this package at all.
"""
requires: pip install pywin32
"""
import win32com.client
# ACE.DAO constants
dbLangGeneral = ";LANGID=0x0409;CP=1252;COUNTRY=0"
dbVersion120 = 128
dbEncrypt = 2
db_path = "C:/Users/Gord/Desktop/secrets.accdb"
db_password = "example"
dbe = win32com.client.Dispatch("DAO.DBEngine.120")
dbe.CreateDatabase(db_path,
dbLangGeneral + ";pwd=" + db_password,
dbVersion120 + dbEncrypt)
Creating a password protected MSAccess database is a common need, manually creating a template database file and copying for every need is not a good way to do.