I have a problem with opening a created Access database with Python script using win32com because always is opened in read-only mode and no queries and macros run spitting a runtime error. I have read a lot on the internet, but I need help ... I don't found the solution ... This is my code, I think it's alright but:
nombreBD = 'path/database.accdb'
os.chmod(nombreBD, S_IWRITE)
objAccess = Dispatch("Access.Application")
objAccess.OpenCurrentDatabase (nombreBD, False)
objAccess.Visible = False
objAccess.DoCmd.RunMacro('Ejecutar')
objAccess.Visible = True
objAccess.CloseCurrentDatabase
objAccess.Application.Quit()
I made this previous steps:
- User permissions to the file & folder
- Check my privacy in Office trust center: Link
- Adding trust path
- Allow script executions ...
- Read-only Access database turn off
When I open manually the desired database.accdb, it's okay, no problem and I can execute all but if I run it from Python Script, always is opened in read-only mode ... like if other process was active when the script call the file ... but I also check this and no access process is active and no .laccdb created.
Thank you in advance to all!
I'm running the script on Windows Server 2012.