mrmmickle1
Well-known Member
- Joined
- May 11, 2012
- Messages
- 2,461
I am trying to create a database and then create a few tables in the database. I am having trouble creating the database. This is what I have so far:
It will not run on the red line of code. Any pointers or help would be appreciated. Just starting to get into Access VBA...
Code:
Sub CreatePendingLogDB()
[COLOR=#0000ff] Dim[/COLOR] TableArr [COLOR=#0000ff]As[/COLOR] Variant
[COLOR=#0000ff] Dim[/COLOR] accessApp [COLOR=#0000ff]As [/COLOR]Access.Application
[COLOR=#0000ff]Dim [/COLOR]DBFileString [COLOR=#0000ff]As String[/COLOR]
[COLOR=#0000ff] Set[/COLOR] accessApp = [COLOR=#0000ff]New [/COLOR]Access.Application
DBFileString = "C:\Users\" & Environ("UserName") & "\Desktop\PendingLog" & Format(Date, "MM.DD.YYYY") & ".accdb"
[COLOR=#008000] 'Get Stuck Here Run Time 3001 Invalid Argument[/COLOR]
[COLOR=#ff0000] accessApp.DBEngine.CreateDatabase DBFileString, dbLangGeneral[/COLOR]
It will not run on the red line of code. Any pointers or help would be appreciated. Just starting to get into Access VBA...