How can a blank MS Access database be created using VBA?
The name of the locale constant in the CreateDatabase method is wrong:
This:
accessApp.DBEngine.CreateDatabase "C:\tblImport.accdb", dbLangGenera
Should be:
accessApp.DBEngine.CreateDatabase "D:\tblImport.accdb", DB_LANG_GENERAL
Change that and your code should work. (It does for me at least).
Old question, but it was useful for me. Seems like you don't even need Access object.
Access.DBEngine.CreateDatabase "D:\tblImport.accdb", DB_LANG_GENERAL
works fine for me.
Old Question. Here are my two cents. You have a typo...
dbLangGenera
should be dbLangGeneral
More about it in Workspace.CreateDatabase Method (DAO)
Voting to close this question as per Dealing with questions with obvious replies
Try this. This works.
Sub makedb()
Dim accessApp As Access.Application
Set accessApp = New Access.Application
accessApp.DBEngine.CreateDatabase "C:\tblImport.accdb", dbLangGeneral
accessApp.Quit
Set accessApp = Nothing
End Sub
EDIT: Will delete this answer and post it as a comment once the post is closed.