You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to call and execute VBA modules that are stored within my MicroSoft Access database. However, I cannot get it to work and do not understand why. Any help would be appreciated. This is the sample code:
Sample code:
importwin32com.clientdbPath=r"C:\some\path\to your database\Database.accdb"# Open Access applicationaccess=win32com.client.Dispatch("Access.Application")
# Open the databaseaccess.OpenCurrentDatabase(dbPath)
# Run the VBA functionresult=access.Run("HelloWorld")
# Close database and quit Accessaccess.CloseCurrentDatabase()
access.Quit()
VBA module in Access
PublicFunctionHelloWorld() AsString
HelloWorld = "Hello from Access, world!"End Function
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Issue:
I am trying to call and execute VBA modules that are stored within my MicroSoft Access database. However, I cannot get it to work and do not understand why. Any help would be appreciated. This is the sample code:
Sample code:
VBA module in Access
Error message:
Extra:
Beta Was this translation helpful? Give feedback.
All reactions