Josh,
Public Function CreateNewDatabase(strDBName As String, _
CollatingOrder As CollatingOrderEnum, _
DatabaseType As DatabaseTypeEnum) As
Database
Dim ws As Workspace
'Get the default Workspace.
Set ws = DBEngine(0)
'Make sure there isn't already a database with the same filespec.
If Len(Dir(strDBName)) > 0 Then
DoCmd.Beep
If vbYes = MsgBox("A database with this name already exists." &
vbCrLf & _
"Do you want to replace it with the new
database?", _
vbYesNo + vbQuestion, "Duplicate database name")
Then
Kill strDBName
Else
Set CreateNewDatabase = Nothing
GoTo Proc_Exit
End If
End If
'Create the new database, and return a reference to it.
Set CreateNewDatabase = ws.CreateDatabase(strDBName, CollatingOrder,
DatabaseType)
Proc_Exit:
Set ws = Nothing
End Function
Regards,
Graham R Seach
Microsoft Access MVP
Canberra, Australia